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