001    package org.picocontainer.defaults;
002    
003    import junit.framework.TestCase;
004    
005    import java.beans.IntrospectionException;
006    
007    /**
008     * @author Aslak Hellesøy
009     * @version $Revision: 3139 $
010     */
011    public class SetterIntrospectorTestCase extends TestCase {
012        public static class TestBean {
013            public void setPublicMethod(int i) {
014            }
015    
016            public void setPublicMETHODAgain(int i) {
017            }
018    
019            public void setMOOky(int i) {
020            }
021    
022            public void setFOOBAR(int i) {
023            }
024    
025            public void set(int i) {
026            }
027    
028            public void sets(int i) {
029            }
030    
031            public void fooBar(int i) {
032            }
033    
034            public void setX(int i) {
035            }
036    
037            public static void setStaticMethod(int i) {
038            }
039    
040            public static void setMany() {
041            }
042    
043            protected void setProtectedMethod(int i) {
044            }
045    
046            private void setPrivateMethod(int i) {
047            }
048        }
049    
050        public void testShouldConvertPropertyNamesInSameWayAsBeanInfo() throws IntrospectionException {
051    
052    // TODO - to test via SetterInjectionComponentAdaptor with mock/expects.
053    
054    //        BeanInfo beanInfo = Introspector.getBeanInfo(TestBean.class);
055    //        PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
056    //
057    //        Map setters = getSetters(TestBean.class);
058    //        assertEquals(propertyDescriptors.length, setters.size());
059    //
060    //        for (int i = 0; i < propertyDescriptors.length; i++) {
061    //            PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
062    //            String expectedPropertyName = propertyDescriptor.getName();
063    //            assertEquals("No property found for " + expectedPropertyName, propertyDescriptor.getWriteMethod(), setters.get(expectedPropertyName));
064    //        }
065        }
066    
067    }