KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > defaults > SetterIntrospectorTestCase


1 package org.picocontainer.defaults;
2
3 import junit.framework.TestCase;
4
5 import java.beans.IntrospectionException JavaDoc;
6
7 /**
8  * @author Aslak Hellesøy
9  * @version $Revision: 3139 $
10  */

11 public class SetterIntrospectorTestCase extends TestCase {
12     public static class TestBean {
13         public void setPublicMethod(int i) {
14         }
15
16         public void setPublicMETHODAgain(int i) {
17         }
18
19         public void setMOOky(int i) {
20         }
21
22         public void setFOOBAR(int i) {
23         }
24
25         public void set(int i) {
26         }
27
28         public void sets(int i) {
29         }
30
31         public void fooBar(int i) {
32         }
33
34         public void setX(int i) {
35         }
36
37         public static void setStaticMethod(int i) {
38         }
39
40         public static void setMany() {
41         }
42
43         protected void setProtectedMethod(int i) {
44         }
45
46         private void setPrivateMethod(int i) {
47         }
48     }
49
50     public void testShouldConvertPropertyNamesInSameWayAsBeanInfo() throws IntrospectionException JavaDoc {
51
52 // TODO - to test via SetterInjectionComponentAdaptor with mock/expects.
53

54 // BeanInfo beanInfo = Introspector.getBeanInfo(TestBean.class);
55
// PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
56
//
57
// Map setters = getSetters(TestBean.class);
58
// assertEquals(propertyDescriptors.length, setters.size());
59
//
60
// for (int i = 0; i < propertyDescriptors.length; i++) {
61
// PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
62
// String expectedPropertyName = propertyDescriptor.getName();
63
// assertEquals("No property found for " + expectedPropertyName, propertyDescriptor.getWriteMethod(), setters.get(expectedPropertyName));
64
// }
65
}
66
67 }
68
Popular Tags