210211212213214215216217218219220
{ DoubleTranslator t = new DoubleTranslator("min=07,max=207.5"); try { t.translate(null, null, "208.3", null); unreachable(); } catch (ApplicationRuntimeException ex) { assertExceptionSubstring(ex, RulesMessages.maxDoubleValue("208.3", 207.5));
223224225226227228229230231232233
public void testDoubleDefaultValue() { DoubleTranslator t = new DoubleTranslator("default=7.77"); assertEquals(new Double(7.77), t.translate(null, null, null, null)); } public void testDoubleInvalid() { DoubleTranslator t = new DoubleTranslator("default=13");
178179180181182183184185186187188
*/ public void testDoubleTranslator() { DoubleTranslator t = new DoubleTranslator(); assertEquals(new Double(10.7), t.translate(null, null, "10.7", null)); } public void testDoubleDefault() { DoubleTranslator t = new DoubleTranslator();
185186187188189190191192193194195
public void testDoubleDefault() { DoubleTranslator t = new DoubleTranslator(); assertEquals(new Double(0), t.translate(null, null, null, null)); } public void testDoubleLow() { DoubleTranslator t = new DoubleTranslator("min=5.25,max=200");
194195196197198199200201202203204
{ DoubleTranslator t = new DoubleTranslator("min=5.25,max=200"); try { t.translate(null, null, "3", null); unreachable(); } catch (ApplicationRuntimeException ex) { assertExceptionSubstring(ex, RulesMessages.minDoubleValue("3", 5.25));
209210211212213214215216217218219
222223224225226227228229230231232
231232233234235236237238239240241
{ DoubleTranslator t = new DoubleTranslator("default=13"); try { t.translate(null, null, "qbert", null); unreachable(); } catch (ApplicationRuntimeException ex) { assertExceptionSubstring(ex, "'qbert' is not a double value.");