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();
16 }
17
18
19
20
21
22
23 protected Object createValue(int valueCount) {
24
25 if (valueCount == 1) return System.currentTimeMillis() % 1 > 0 ?
26 Boolean.TRUE : Boolean.FALSE;
27
28 Boolean[] values = new Boolean[valueCount];
29 for (int i=0; i<values.length; i++) values[i] = (Boolean)createValue(1);
30 return values;
31 }
32
33 @Test
34 public void testErrorForBad() {
35
36 }
37
38 protected Object createBadValue(int count) {
39 return null;
40 }
41
42
43
44
45
46
47
48 protected PropertyDescriptor createProperty(boolean multiValue) {
49 return multiValue ?
50 new BooleanMultiProperty("testBoolean", "Test boolean property", new Boolean[] {false, true, true}, 1.0f) :
51 new BooleanProperty("testBoolean", "Test boolean property", false, 1.0f);
52 }
53
54
55
56
57
58
59 protected PropertyDescriptor createBadProperty(boolean multiValue) {
60 return multiValue ?
61 new BooleanMultiProperty("", "Test boolean property", new Boolean[] {false, true, true}, 1.0f) :
62 new BooleanProperty("testBoolean", "", false, 1.0f);
63 }
64
65 public static junit.framework.Test suite() {
66 return new junit.framework.JUnit4TestAdapter(BooleanPropertyTest.class);
67 }
68 }