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 org.junit.jupiter.api.Test;
20
21
22
23
24 public class IntegerTest extends AbstractNumberTest {
25
26 public IntegerTest() {
27 formKey = "intForm";
28 action = "int";
29 }
30
31
32
33
34 @Test
35 public void testInt() throws ValidatorException {
36
37 final ValueBean info = new ValueBean();
38 info.setValue("0");
39
40 valueTest(info, true);
41 }
42
43
44
45
46 @Test
47 public void testIntBeyondMax() throws ValidatorException {
48
49 final ValueBean info = new ValueBean();
50 info.setValue(Integer.MAX_VALUE + "1");
51
52 valueTest(info, false);
53 }
54
55
56
57
58 @Test
59 public void testIntBeyondMin() throws ValidatorException {
60
61 final ValueBean info = new ValueBean();
62 info.setValue(Integer.MIN_VALUE + "1");
63
64 valueTest(info, false);
65 }
66
67
68
69
70 @Test
71 public void testIntegerMax() throws ValidatorException {
72
73 final ValueBean info = new ValueBean();
74 info.setValue(Integer.toString(Integer.MAX_VALUE));
75
76 valueTest(info, true);
77 }
78
79
80
81
82 @Test
83 public void testIntFailure() throws ValidatorException {
84
85 final ValueBean info = new ValueBean();
86
87 valueTest(info, false);
88 }
89
90
91
92
93 @Test
94 public void testIntMin() throws ValidatorException {
95
96 final ValueBean info = new ValueBean();
97 info.setValue(Integer.toString(Integer.MIN_VALUE));
98
99 valueTest(info, true);
100 }
101
102 }