1 package test.net.sourceforge.pmd.properties;
2
3 import net.sourceforge.pmd.PropertyDescriptor;
4 import net.sourceforge.pmd.properties.FloatProperty;
5
6 /***
7 */
8 public class FloatPropertyTest extends AbstractPropertyDescriptorTester {
9
10 public FloatPropertyTest() {
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 Float((int)(System.currentTimeMillis() % 100));
22
23 Float[] values = new Float[count];
24 for (int i=0; i<values.length; i++) values[i] = (Float)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 FloatProperty("testFloat", "Test float property", 9.0f, 1.0f) :
37 new FloatProperty("testFloat", "Test float property", new float[] {-1,0,1,2}, 1.0f, maxCount);
38 }
39
40 }