/** * Typesafe Getter for the Double represented by the provided key with * default value to return if key is not represented. * * @param key The key to get a value for * @param defaultDouble Default to return if key is not represented * @return The <code>double</code> value if key is represented, specified * default otherwise */ public double getDouble(String key, double defaultDouble) { if (!containsKey(key)) { return defaultDouble; } return getDouble(key); }
@Test public void testInvalidCast() { context.putLong("1", 1); try { context.getDouble("1"); fail(); } catch (ClassCastException ex) { // expected } }
key = key.replace("(double)", ""); if (executionContext.containsKey(key)) { builder.addDouble(key, executionContext.getDouble(key));
@Test public void testNormalUsage() { context.putString("1", "testString1"); context.putString("2", "testString2"); context.putLong("3", 3); context.putDouble("4", 4.4); context.putInt("5", 5); assertEquals("testString1", context.getString("1")); assertEquals("testString2", context.getString("2")); assertEquals("defaultString", context.getString("55", "defaultString")); assertEquals(4.4, context.getDouble("4"), 0); assertEquals(5.5, context.getDouble("55", 5.5), 0); assertEquals(3, context.getLong("3")); assertEquals(5, context.getLong("55", 5)); assertEquals(5, context.getInt("5")); assertEquals(6, context.getInt("55", 6)); }
/** * Typesafe Getter for the Double represented by the provided key with * default value to return if key is not represented. * * @param key The key to get a value for * @param defaultDouble Default to return if key is not represented * @return The <code>double</code> value if key is represented, specified * default otherwise */ public double getDouble(String key, double defaultDouble) { if (!containsKey(key)) { return defaultDouble; } return getDouble(key); }
key = key.replace("(double)", ""); if (executionContext.containsKey(key)) { builder.addDouble(key, executionContext.getDouble(key));
key = key.replace("(double)", ""); if (executionContext.containsKey(key)) { builder.addDouble(key, executionContext.getDouble(key));
key = key.replace("(double)", ""); if (executionContext.containsKey(key)) { builder.addDouble(key, executionContext.getDouble(key));
key = key.replace("(double)", ""); if (executionContext.containsKey(key)) { builder.addDouble(key, executionContext.getDouble(key));