@Test public void testMatchMethodOrConstructor() { List<MethodToLog> methodToLogs = new Gson() .fromJson(METHODS_TO_LOG, new TypeToken<List<MethodToLog>>() { }.getType()); Set<Member> methods = new HashSet<>(); methods.addAll(Arrays.asList(TestMatchMethod.class.getDeclaredMethods())); methods.addAll(Arrays.asList(TestMatchMethod.class.getDeclaredConstructors())); methods.addAll(Arrays.asList(TestMatchMethod.InnerClass.class.getDeclaredMethods())); methods.addAll(Arrays.asList(TestMatchMethod.InnerClass.class.getDeclaredConstructors())); methods.addAll(Arrays.asList(TestMatchMethod.StaticNestedClass.class.getDeclaredMethods())); methods.addAll( Arrays.asList(TestMatchMethod.StaticNestedClass.class.getDeclaredConstructors())); for (Member member : methods) { int matchCount = 0; for (MethodToLog methodToLog : methodToLogs) { if (methodToLog.matchMethodOrConstructor(member)) { matchCount++; } } assertThat(matchCount, is(1)); } assertThat(methodToLogs.size(), is(methods.size())); }
public boolean matchMethodOrConstructor(Member member) { if (member instanceof Method) { return matchMethod((Method) member); } else if (member instanceof Constructor) { return matchMethod((Constructor) member); } return false; }
MethodToLog { public boolean matchMethodOrConstructor(Member member) { if (member instanceof Method) { return matchMethod((Method) member); } else if (member instanceof Constructor) { return matchMethod((Constructor) member); } return false; } }
MethodToLog { public boolean matchMethodOrConstructor(Member member) { if (member instanceof Method) { return matchMethod((Method) member); } else if (member instanceof Constructor) { return matchMethod((Constructor) member); } return false; } MethodToLog(int type, String className, String methodName, List<String> parameterClasses,
            List<String> parameterNames); }
MethodToLog { public boolean matchMethodOrConstructor(Member member) { if (member instanceof Method) { return matchMethod((Method) member); } else if (member instanceof Constructor) { return matchMethod((Constructor) member); } return false; } MethodToLog(int type, String className, String methodName, List<String> parameterClasses,
            List<String> parameterNames); int getType(); String getClassName(); String getName(); List<String> getParameterClasses(); List<String> getParameterNames(); boolean isMethod(); boolean isConstructor(); boolean matchMethodOrConstructor(Member member); @Override String toString(); }
MethodToLog { public boolean matchMethodOrConstructor(Member member) { if (member instanceof Method) { return matchMethod((Method) member); } else if (member instanceof Constructor) { return matchMethod((Constructor) member); } return false; } MethodToLog(int type, String className, String methodName, List<String> parameterClasses,
            List<String> parameterNames); int getType(); String getClassName(); String getName(); List<String> getParameterClasses(); List<String> getParameterNames(); boolean isMethod(); boolean isConstructor(); boolean matchMethodOrConstructor(Member member); @Override String toString();  }