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