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 LongTest extends AbstractNumberTest {
25
26 public LongTest() {
27 FORM_KEY = "longForm";
28 ACTION = "long";
29 }
30
31
32
33
34 @Test
35 public void testLong() 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 testLongBeyondMax() throws ValidatorException {
48
49 final ValueBean info = new ValueBean();
50 info.setValue(Long.MAX_VALUE + "1");
51
52 valueTest(info, false);
53 }
54
55
56
57
58 @Test
59 public void testLongBeyondMin() throws ValidatorException {
60
61 final ValueBean info = new ValueBean();
62 info.setValue(Long.MIN_VALUE + "1");
63
64 valueTest(info, false);
65 }
66
67
68
69
70 @Test
71 public void testLongFailure() throws ValidatorException {
72
73 final ValueBean info = new ValueBean();
74
75 valueTest(info, false);
76 }
77
78
79
80
81 @Test
82 public void testLongMax() throws ValidatorException {
83
84 final ValueBean info = new ValueBean();
85 info.setValue(Long.toString(Long.MAX_VALUE));
86
87 valueTest(info, true);
88 }
89
90
91
92
93 @Test
94 public void testLongMin() throws ValidatorException {
95
96 final ValueBean info = new ValueBean();
97 info.setValue(Long.toString(Long.MIN_VALUE));
98
99 valueTest(info, true);
100 }
101
102 }