Configuration { public static float valueAsFloat(String key, float defaultVal) { String val = valueFor(key); if (val == null) { return defaultVal; } float fval; try { fval = Float.valueOf(val).floatValue(); } catch (NumberFormatException nex) { XRLog.log(Level.WARNING, LogMessageId.LogMessageId4Param.EXCEPTION_CONFIGURATION_WRONG_TYPE, key, "float", val, "float"); fval = defaultVal; } return fval; } private  Configuration(); static void setConfigLogger(Logger logger); static String valueFor(String key); static boolean hasValue(String key); static int valueAsByte(String key, byte defaultVal); static int valueAsShort(String key, short defaultVal); static int valueAsInt(String key, int defaultVal); static long valueAsLong(String key, long defaultVal); static float valueAsFloat(String key, float defaultVal); static double valueAsDouble(String key, double defaultVal); static String valueFor(String key, String defaultVal); static Iterator<String> keysByPrefix(String prefix); static boolean isTrue(String key, boolean defaultVal); static boolean isFalse(String key, boolean defaultVal); static Object valueFromClassConstant(String key, Object defaultValue);  }
@Test public void testValueAsFloat() { String key = "xr.test-config-float"; float value = Configuration.valueAsFloat(key, (float) 0); assertThat(value, is(3000.25F)); }