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