### Question:
Reflection { public static boolean isGetter(Method method) { String name = method.getName(); if (method.getParameterTypes().length == 0) { Class<?> returnType = method.getReturnType(); if (name.startsWith("get") && name.length() > 3 && Character.isUpperCase(name.charAt(3)) && returnType != Void.TYPE) { return true; } if (name.startsWith("is") && name.length() > 2 && Character.isUpperCase(name.charAt(2)) && (returnType == Boolean.TYPE || returnType == Boolean.class)) { return true; } } return false; } private  Reflection(); static Type resultType(Type declaringType, Type type); static Type variableType(ParameterizedType type, TypeVariable<?> variable); static Class<?> getClass(Type type); static boolean isGetter(Method method); static boolean isListIndex(Method method);  }### Answer:
@Test public void getters() throws Exception { assertTrue(Reflection.isGetter(Foo.class.getMethod("getProperty"))); assertFalse(Reflection.isGetter(Foo.class.getMethod("getNonProperty", String.class))); assertFalse(Reflection.isGetter(Foo.class.getMethod("getnonProperty"))); assertFalse(Reflection.isGetter(Foo.class.getMethod("isNonProperty"))); assertFalse(Reflection.isGetter(Foo.class.getMethod("nonProperty"))); assertFalse(Reflection.isGetter(Foo.class.getMethod("getNonProperty"))); assertTrue(Reflection.isGetter(Foo.class.getMethod("isProperty"))); }