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