1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.validator;
18
19
20
21
22
23
24
25
26 public class ByteTest extends AbstractNumberTest {
27
28 public ByteTest(String name) {
29 super(name);
30 ACTION = "byte";
31 FORM_KEY = "byteForm";
32 }
33
34
35
36
37 public void testByte() throws ValidatorException {
38
39 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
40 info.setValue("0");
41
42 valueTest(info, true);
43 }
44
45
46
47
48 public void testByteMin() throws ValidatorException {
49
50 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
51 info.setValue(Byte.valueOf(Byte.MIN_VALUE).toString());
52
53 valueTest(info, true);
54 }
55
56
57
58
59 public void testByteMax() throws ValidatorException {
60
61 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
62 info.setValue(Byte.valueOf(Byte.MAX_VALUE).toString());
63
64 valueTest(info, true);
65 }
66
67
68
69
70 public void testByteFailure() throws ValidatorException {
71
72 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
73
74 valueTest(info, false);
75 }
76
77
78
79
80 public void testByteBeyondMin() throws ValidatorException {
81
82 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
83 info.setValue(Byte.MIN_VALUE + "1");
84
85 valueTest(info, false);
86 }
87
88
89
90
91 public void testByteBeyondMax() throws ValidatorException {
92
93 ValueBeanValueBean.html#ValueBean">ValueBean info = new ValueBean();
94 info.setValue(Byte.MAX_VALUE + "1");
95
96 valueTest(info, false);
97 }
98
99 }