Utils { protected static List<String> getMethods(Class<?> klass) { Map<Method, Boolean> methodMap = new HashMap<Method, Boolean>(); for (Method m : klass.getMethods()) { methodMap.put(m, true); } Method[] methods = klass.getDeclaredMethods(); List<String> methodNames = new ArrayList<String>(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (methodMap.get(m) != null && methodMap.get(m) == true) { methodNames.add(m.getName()); } } return methodNames; }  @SuppressWarnings("unchecked") static Object constructRefs(Bridge bridge, Map<String, Object> theMap); static boolean isRemoteObject(Class<?> klass); static Class<?> autobox(Class<?> klass); static Object defaultValueForPrimitive(Class<?> primitive); static final String DEFAULT_REDIRECTOR; static final BridgeEventHandler DEFAULT_EVENT_HANDLER; static final boolean DEFAULT_RECONNECT; static final String DEFAULT_SECURE_REDIRECTOR; static int logLevel; }
@Test public void testGetMethods() { Object a = new Object() { public void foo() { } public void bar() { } protected void baz() { } private void qux() { } }; List<String> methods = Utils.getMethods(a.getClass()); assertEquals(Arrays.asList("foo", "bar"), methods); }