1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.commons.validator;
23
24 import junit.framework.Test;
25 import junit.framework.TestSuite;
26
27 /***
28 * Performs Validation Test for <code>double</code> validations.
29 */
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 /***
40 * Start the tests.
41 *
42 * @param theArgs the arguments. Not used
43 */
44 public static void main(String[] theArgs) {
45 junit.awtui.TestRunner.main(new String[]{DoubleTest.class.getName()});
46 }
47
48 /***
49 * @return a test suite (<code>TestSuite</code>) that includes all methods
50 * starting with "test"
51 */
52 public static Test suite() {
53
54 return new TestSuite(DoubleTest.class);
55 }
56
57
58 /***
59 * Tests the double validation.
60 */
61 public void testDouble() throws ValidatorException {
62
63 ValueBean info = new ValueBean();
64 info.setValue("0");
65
66 valueTest(info, true);
67 }
68
69 /***
70 * Tests the double validation.
71 */
72 public void testDoubleMin() throws ValidatorException {
73
74 ValueBean info = new ValueBean();
75 info.setValue(new Double(Double.MIN_VALUE).toString());
76
77 valueTest(info, true);
78 }
79
80 /***
81 * Tests the double validation.
82 */
83 public void testDoubleMax() throws ValidatorException {
84
85 ValueBean info = new ValueBean();
86 info.setValue(new Double(Double.MAX_VALUE).toString());
87
88 valueTest(info, true);
89 }
90
91 /***
92 * Tests the double validation failure.
93 */
94 public void testDoubleFailure() throws ValidatorException {
95
96 ValueBean info = new ValueBean();
97
98 valueTest(info, false);
99 }
100
101 }