01: package test.net.sourceforge.pmd.properties;
02:
03: import net.sourceforge.pmd.PropertyDescriptor;
04: import net.sourceforge.pmd.properties.IntegerProperty;
05:
06: /**
07: */
08: public class IntegerPropertyTest extends
09: AbstractPropertyDescriptorTester {
10:
11: /**
12: * Method createValue.
13: * @param count int
14: * @return Object
15: */
16: protected Object createValue(int count) {
17:
18: if (count == 1)
19: return new Integer((int) (System.currentTimeMillis() % 100));
20:
21: Integer[] values = new Integer[count];
22: for (int i = 0; i < values.length; i++)
23: values[i] = (Integer) createValue(1);
24: return values;
25: }
26:
27: /**
28: * Method createProperty.
29: * @param maxCount int
30: * @return PropertyDescriptor
31: */
32: protected PropertyDescriptor createProperty(int maxCount) {
33:
34: return maxCount == 1 ? new IntegerProperty("testInteger",
35: "Test integer property", 9, 1.0f)
36: : new IntegerProperty("testInteger",
37: "Test integer property", new int[] { -1, 0, 1,
38: 2 }, 1.0f, maxCount);
39: }
40:
41: public static junit.framework.Test suite() {
42: return new junit.framework.JUnit4TestAdapter(
43: IntegerPropertyTest.class);
44: }
45: }
|