/** Unit test for handleSetter. */ @Test public void testHandleMethod_GetterAndSetter() { TypeAnalysis analysis = new TypeAnalysis(); analysis.clazz = IBeanWithIdAndNameImpl.class; Method setter = AccessorUtils.getSetter("beanName", String.class, analysis.clazz); analysis.handleMethod(setter); Method getter = AccessorUtils.getGetter("beanName", String.class, analysis.clazz); analysis.handleMethod(getter); Array key = new Array("beanName", String.class); BeanPropertyDefinition<?> bpd = analysis.allProperties.get(key); Assert.assertNotNull(bpd); Assert.assertNotNull(bpd.getGetter()); Assert.assertNotNull(bpd.getSetter()); }
/** Unit test for handleSetter. */ @Test public void testHandleMethod_abstractSetter() { TypeAnalysis analysis = new TypeAnalysis(); analysis.clazz = IBeanWithIdAndName.class; Method setter = AccessorUtils.getSetter("beanName", String.class, analysis.clazz); analysis.handleMethod(setter); Assert.assertTrue(analysis.abstractGetters.isEmpty()); Assert.assertTrue(analysis.concreteGetters.isEmpty()); Assert.assertTrue(analysis.abstractSetters.contains(setter)); Assert.assertTrue(analysis.concreteSetters.isEmpty()); Assert.assertTrue(analysis.abstractMethods.isEmpty()); Assert.assertTrue(analysis.concreteMethods.isEmpty()); Array key = new Array("beanName", String.class); // ??? BeanPropertyDefinition<?> bpd = analysis.allProperties.get(key); Assert.assertNotNull(bpd); Assert.assertNotNull(bpd.getSetter()); }