01: package nl.knowlogy.validation.test.xdoclet;
02:
03: import nl.knowlogy.validation.ErrorCodes;
04: import nl.knowlogy.validation.Messages;
05: import nl.knowlogy.validation.test.xdoclet.testclasses.IntegerTestClass;
06:
07: public class IntegerPropertiesTest extends PropertyValidationTestCase {
08:
09: public void testMinSizeInvalidPrimitiveInt() {
10:
11: IntegerTestClass integerTestClass = new IntegerTestClass();
12: integerTestClass.setIntPrimitiveValue(49);
13:
14: Messages messages = doValidation(integerTestClass);
15: assertErrorMessageForProperty(messages, integerTestClass,
16: "intPrimitiveValue", ErrorCodes.INVALID_MIN_SIZE);
17:
18: }
19:
20: public void testMinSizeValidPrimitiveInt() {
21:
22: IntegerTestClass integerTestClass = new IntegerTestClass();
23: integerTestClass.setIntPrimitiveValue(50);
24:
25: Messages messages = doValidation(integerTestClass);
26: assertNoErrorMessageForProperty(messages, integerTestClass,
27: "intPrimitiveValue", ErrorCodes.INVALID_MIN_SIZE);
28:
29: }
30:
31: public void testMaxSizeInvalidPrimitiveInt() {
32:
33: IntegerTestClass integerTestClass = new IntegerTestClass();
34: integerTestClass.setIntPrimitiveValue(101);
35:
36: Messages messages = doValidation(integerTestClass);
37: assertErrorMessageForProperty(messages, integerTestClass,
38: "intPrimitiveValue", ErrorCodes.INVALID_MAX_SIZE);
39:
40: }
41:
42: public void testMaxSizeValidPrimitiveInt() {
43:
44: IntegerTestClass integerTestClass = new IntegerTestClass();
45: integerTestClass.setIntPrimitiveValue(100);
46:
47: Messages messages = doValidation(integerTestClass);
48: assertNoErrorMessageForProperty(messages, integerTestClass,
49: "intPrimitiveValue", ErrorCodes.INVALID_MAX_SIZE);
50:
51: }
52:
53: public void testMinSizeInvalidInteger() {
54:
55: IntegerTestClass integerTestClass = new IntegerTestClass();
56: integerTestClass.setIntPrimitiveValue(49);
57:
58: Messages messages = doValidation(integerTestClass);
59: assertErrorMessageForProperty(messages, integerTestClass,
60: "intPrimitiveValue", ErrorCodes.INVALID_MIN_SIZE);
61:
62: }
63:
64: public void testMinSizeValidInteger() {
65:
66: IntegerTestClass integerTestClass = new IntegerTestClass();
67: integerTestClass.setIntPrimitiveValue(50);
68:
69: Messages messages = doValidation(integerTestClass);
70: assertNoErrorMessageForProperty(messages, integerTestClass,
71: "intPrimitiveValue", ErrorCodes.INVALID_MIN_SIZE);
72:
73: }
74:
75: public void testMaxSizeInvalidInteger() {
76:
77: IntegerTestClass integerTestClass = new IntegerTestClass();
78: integerTestClass.setIntPrimitiveValue(101);
79:
80: Messages messages = doValidation(integerTestClass);
81: assertErrorMessageForProperty(messages, integerTestClass,
82: "intPrimitiveValue", ErrorCodes.INVALID_MAX_SIZE);
83:
84: }
85:
86: public void testMaxSizeValidInteger() {
87:
88: IntegerTestClass integerTestClass = new IntegerTestClass();
89: integerTestClass.setIntPrimitiveValue(100);
90:
91: Messages messages = doValidation(integerTestClass);
92: assertNoErrorMessageForProperty(messages, integerTestClass,
93: "intPrimitiveValue", ErrorCodes.INVALID_MAX_SIZE);
94:
95: }
96:
97: }
|