01: package test.net.sourceforge.pmd.properties;
02:
03: import net.sourceforge.pmd.PropertyDescriptor;
04: import net.sourceforge.pmd.properties.DoubleProperty;
05:
06: /**
07: */
08: public class DoublePropertyTest extends
09: AbstractPropertyDescriptorTester {
10:
11: public DoublePropertyTest() {
12: super ();
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)
23: return new Double((int) (System.currentTimeMillis() % 100));
24:
25: Double[] values = new Double[count];
26: for (int i = 0; i < values.length; i++)
27: values[i] = (Double) createValue(1);
28: return values;
29: }
30:
31: /**
32: * Method createProperty.
33: * @param maxCount int
34: * @return PropertyDescriptor
35: */
36: protected PropertyDescriptor createProperty(int maxCount) {
37:
38: return maxCount == 1 ? new DoubleProperty("testDouble",
39: "Test double property", 9.0, 1.0f)
40: : new DoubleProperty("testDouble",
41: "Test double property", new double[] { -1, 0,
42: 1, 2 }, 1.0f, maxCount);
43: }
44:
45: public static junit.framework.Test suite() {
46: return new junit.framework.JUnit4TestAdapter(
47: DoublePropertyTest.class);
48: }
49: }
|