1 21 22 package org.apache.commons.validator; 23 24 import junit.framework.Test; 25 import junit.framework.TestSuite; 26 27 30 public class DoubleTest extends TestNumber { 31 32 public DoubleTest(String name) { 33 super(name); 34 ACTION = "double"; 35 FORM_KEY = "doubleForm"; 36 } 37 38 39 44 public static void main(String [] theArgs) { 45 junit.awtui.TestRunner.main(new String []{DoubleTest.class.getName()}); 46 } 47 48 52 public static Test suite() { 53 return new TestSuite(DoubleTest.class); 55 } 56 57 58 61 public void testDouble() throws ValidatorException { 62 ValueBean info = new ValueBean(); 64 info.setValue("0"); 65 66 valueTest(info, true); 67 } 68 69 72 public void testDoubleMin() throws ValidatorException { 73 ValueBean info = new ValueBean(); 75 info.setValue(new Double (Double.MIN_VALUE).toString()); 76 77 valueTest(info, true); 78 } 79 80 83 public void testDoubleMax() throws ValidatorException { 84 ValueBean info = new ValueBean(); 86 info.setValue(new Double (Double.MAX_VALUE).toString()); 87 88 valueTest(info, true); 89 } 90 91 94 public void testDoubleFailure() throws ValidatorException { 95 ValueBean info = new ValueBean(); 97 98 valueTest(info, false); 99 } 100 101 } | Popular Tags |