01: package test.net.sourceforge.pmd.properties;
02:
03: import net.sourceforge.pmd.PropertyDescriptor;
04: import net.sourceforge.pmd.properties.BooleanProperty;
05:
06: /**
07: * @author Brian Remedios
08: */
09: public class BooleanPropertyTest extends
10: AbstractPropertyDescriptorTester {
11:
12: public BooleanPropertyTest() {
13: super ();
14: }
15:
16: /**
17: * Method createValue.
18: * @param valueCount int
19: * @return Object
20: */
21: public Object createValue(int valueCount) {
22:
23: if (valueCount == 1)
24: return System.currentTimeMillis() % 1 > 0 ? Boolean.TRUE
25: : Boolean.FALSE;
26:
27: Boolean[] values = new Boolean[valueCount];
28: for (int i = 0; i < values.length; i++)
29: values[i] = (Boolean) createValue(1);
30: return values;
31: }
32:
33: /**
34: * Method createProperty.
35: * @param maxValues int
36: * @return PropertyDescriptor
37: */
38: public PropertyDescriptor createProperty(int maxValues) {
39: return maxValues == 1 ? new BooleanProperty("testBoolean",
40: "Test boolean property", false, 1.0f)
41: : new BooleanProperty("testBoolean",
42: "Test boolean property",
43: new boolean[] { false }, 1.0f, maxValues);
44: }
45:
46: public static junit.framework.Test suite() {
47: return new junit.framework.JUnit4TestAdapter(
48: BooleanPropertyTest.class);
49: }
50: }
|