KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > properties > TypePropertyTest


1 package test.net.sourceforge.pmd.properties;
2
3 import java.util.HashMap JavaDoc;
4 import java.util.Map JavaDoc;
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 JavaDoc[] classes = new Class JavaDoc[] { String JavaDoc.class, Integer JavaDoc.class, int.class, HashMap JavaDoc.class, Map JavaDoc.class };
14     
15     public TypePropertyTest() {
16         super();
17     }
18
19     /**
20      * Method createValue.
21      * @param count int
22      * @return Object
23      */

24     protected Object JavaDoc createValue(int count) {
25
26         if (count == 1) return randomChoice(classes);
27         
28         Object JavaDoc[] values = new Object JavaDoc[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 JavaDoc.class, 1.0f) :
42             new TypeProperty("testType", "Test type property", classes, 1.0f);
43             }
44
45 }
46
Popular Tags