### Question:
Reflector { public Class<?> getGetterType(String propertyName) { Class<?> clazz = getTypes.get(propertyName); if (clazz == null) { throw new ReflectionException("There is no getter for property named '" + propertyName + "' in '" + type + "'"); } return clazz; } Reflector(Class<?> clazz); static boolean canControlMemberAccessible(); Class<?> getType(); Constructor<?> getDefaultConstructor(); boolean hasDefaultConstructor(); Invoker getSetInvoker(String propertyName); Invoker getGetInvoker(String propertyName); Class<?> getSetterType(String propertyName); Class<?> getGetterType(String propertyName); String[] getGetablePropertyNames(); String[] getSetablePropertyNames(); boolean hasSetter(String propertyName); boolean hasGetter(String propertyName); String findPropertyName(String name);  }### Answer:
@Test public void testGetGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Section.class); Assert.assertEquals(Long.class, reflector.getGetterType("id")); }
@Test public void shouldResolveGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("id")); }
@Test public void shouldResolveGetterTypeFromPublicField() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("pubFld")); }
@Test public void shouldResolveParameterizedGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(List.class, reflector.getGetterType("list")); }
@Test public void shouldResolveArrayGetterType() throws Exception { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); Class<?> clazz = reflector.getGetterType("array"); assertTrue(clazz.isArray()); assertEquals(String.class, clazz.getComponentType()); }
@Test void testGetGetterType() { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Section.class); Assertions.assertEquals(Long.class, reflector.getGetterType("id")); }
@Test void shouldResolveGetterType() { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("id")); }
@Test void shouldResolveGetterTypeFromPublicField() { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(String.class, reflector.getGetterType("pubFld")); }
@Test void shouldResolveParameterizedGetterType() { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); assertEquals(List.class, reflector.getGetterType("list")); }
@Test void shouldResolveArrayGetterType() { ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); Reflector reflector = reflectorFactory.findForClass(Child.class); Class<?> clazz = reflector.getGetterType("array"); assertTrue(clazz.isArray()); assertEquals(String.class, clazz.getComponentType()); }