1 package test.net.sourceforge.pmd.properties; 2 3 import java.util.HashMap; 4 import java.util.Map; 5 6 import net.sourceforge.pmd.PropertyDescriptor; 7 import net.sourceforge.pmd.properties.TypeProperty; 8 9 /*** 10 */ 11 public class TypePropertyTest extends AbstractPropertyDescriptorTester { 12 13 public static final Class[] classes = new Class[] { String.class, Integer.class, int.class, HashMap.class, Map.class }; 14 15 public TypePropertyTest() { 16 super(); 17 } 18 19 /*** 20 * Method createValue. 21 * @param count int 22 * @return Object 23 */ 24 protected Object createValue(int count) { 25 26 if (count == 1) return randomChoice(classes); 27 28 Object[] values = new Object[count]; 29 for (int i=0; i<values.length; i++) values[i] = createValue(1); 30 return values; 31 } 32 33 /*** 34 * Method createProperty. 35 * @param maxCount int 36 * @return PropertyDescriptor 37 */ 38 protected PropertyDescriptor createProperty(int maxCount) { 39 40 return maxCount == 1 ? 41 new TypeProperty("testType", "Test type property", Byte.class, 1.0f) : 42 new TypeProperty("testType", "Test type property", classes, 1.0f); 43 } 44 45 }