180181182183184185186187188189190
*/ public void testDoubleTranslator() { DoubleTranslator t = new DoubleTranslator(); assertEquals(new Double(10.7), t.translate(null, null, "10.7")); } public void testDoubleDefault() { DoubleTranslator t = new DoubleTranslator();
187188189190191192193194195196197
public void testDoubleDefault() { DoubleTranslator t = new DoubleTranslator(); assertEquals(new Double(0), t.translate(null, null, null)); } public void testDoubleLow() { DoubleTranslator t = new DoubleTranslator("min=5.25,max=200");
196197198199200201202203204205206
{ DoubleTranslator t = new DoubleTranslator("min=5.25,max=200"); try { t.translate(null, null, "3"); unreachable(); } catch (ApplicationRuntimeException ex) { String message = java.text.MessageFormat.format("Value {0} is less than minimum value {1}.",
213214215216217218219220221222223
{ DoubleTranslator t = new DoubleTranslator("min=07,max=207.5"); try { t.translate(null, null, "208.3"); unreachable(); } catch (ApplicationRuntimeException ex) { String message = java.text.MessageFormat.format("Value {0} is greater than maximum value {1}.",
228229230231232233234235236237238
public void testDoubleDefaultValue() { DoubleTranslator t = new DoubleTranslator("default=7.77"); assertEquals(new Double(7.77), t.translate(null, null, null)); } public void testDoubleInvalid() { DoubleTranslator t = new DoubleTranslator("default=13");
237238239240241242243244245246247
{ DoubleTranslator t = new DoubleTranslator("default=13"); try { t.translate(null, null, "qbert"); unreachable(); } catch (ApplicationRuntimeException ex) { assertExceptionSubstring(ex, "'qbert' is not a double value.");
232233234235236237238239240241242
{ 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.");
179180181182183184185186187188189
*/ 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();
186187188189190191192193194195196
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");
195196197198199200201202203204205
{ 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));