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  	public IntegerPropertyTest() {
11  		super();
12  		// TODO Auto-generated constructor stub
13  	}
14  
15  	/***
16  	 * Method createValue.
17  	 * @param count int
18  	 * @return Object
19  	 */
20  	protected Object createValue(int count) {
21  		
22  		if (count == 1) return new Integer((int)(System.currentTimeMillis() % 100));
23  		
24  		Integer[] values = new Integer[count];
25  		for (int i=0; i<values.length; i++) values[i] = (Integer)createValue(1);
26  		return values;
27  	}
28  
29  	/***
30  	 * Method createProperty.
31  	 * @param maxCount int
32  	 * @return PropertyDescriptor
33  	 */
34  	protected PropertyDescriptor createProperty(int maxCount) {
35  		
36  		return maxCount == 1 ?
37  				new IntegerProperty("testInteger", "Test integer property", 9, 1.0f) :
38  				new IntegerProperty("testInteger", "Test integer property", new int[] {-1,0,1,2}, 1.0f, maxCount);
39  		}
40  
41  }