1 package net.sourceforge.pmd.properties;
2
3 import net.sourceforge.pmd.PropertyDescriptor;
4 import net.sourceforge.pmd.lang.rule.properties.BooleanMultiProperty;
5 import net.sourceforge.pmd.lang.rule.properties.BooleanProperty;
6
7 import org.junit.Test;
8
9
10
11
12 public class BooleanPropertyTest extends AbstractPropertyDescriptorTester {
13
14 public BooleanPropertyTest() {
15 super("Boolean");
16 }
17
18
19
20
21
22
23
24 protected Object createValue(int valueCount) {
25
26 if (valueCount == 1)
27 return System.currentTimeMillis() % 1 > 0 ? Boolean.TRUE : Boolean.FALSE;
28
29 Boolean[] values = new Boolean[valueCount];
30 for (int i = 0; i < values.length; i++)
31 values[i] = (Boolean) createValue(1);
32 return values;
33 }
34
35 @Test
36 public void testErrorForBad() {
37
38 }
39
40 protected Object createBadValue(int count) {
41 return null;
42 }
43
44
45
46
47
48
49
50 protected PropertyDescriptor createProperty(boolean multiValue) {
51 return multiValue ? new BooleanMultiProperty("testBoolean", "Test boolean property", new Boolean[] { false,
52 true, true }, 1.0f) : new BooleanProperty("testBoolean", "Test boolean property", false, 1.0f);
53 }
54
55
56
57
58
59
60
61 protected PropertyDescriptor createBadProperty(boolean multiValue) {
62 return multiValue ? new BooleanMultiProperty("", "Test boolean property", new Boolean[] { false, true, true },
63 1.0f) : new BooleanProperty("testBoolean", "", false, 1.0f);
64 }
65 }