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