1 package test.net.sourceforge.pmd.properties; 2 3 import net.sourceforge.pmd.PropertyDescriptor; 4 import net.sourceforge.pmd.properties.CharacterProperty; 5 6 8 public class CharacterPropertyTest extends AbstractPropertyDescriptorTester { 9 10 private static final char delimiter = '|'; 11 private static final char[] charSet = filter(allChars.toCharArray(), delimiter); 12 13 public CharacterPropertyTest() { 14 super(); 15 } 16 17 22 protected Object createValue(int count) { 23 24 if (count == 1) return new Character (randomChar(charSet)); 25 26 Character [] values = new Character [count]; 27 for (int i=0; i<values.length; i++) values[i] = (Character )createValue(1); 28 return values; 29 } 30 31 36 protected PropertyDescriptor createProperty(int maxCount) { 37 38 return maxCount == 1 ? 39 new CharacterProperty("testCharacter", "Test character property", 'a', 1.0f) : 40 new CharacterProperty("testCharacter", "Test character property", new char[] {'a', 'b', 'c'}, 1.0f, delimiter); 41 } 42 43 } 44 | Popular Tags |