Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Dec 9, 2021
1 parent f86251b commit b929935
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -17,6 +17,7 @@

import com.google.common.truth.Correspondence;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
* A {@link Correspondence} to compare methods names and parameters in different classes. An example
Expand All @@ -26,12 +27,14 @@
public class MethodComparator {

public static final Correspondence<Method, Method> METHOD_CORRESPONDENCE =
Correspondence.from(MethodComparator::compareMethods, "compare method names and parameters");
Correspondence.from(
MethodComparator::compareMethods, "compare method names, return types and parameters");

private static boolean compareMethods(Method actual, Method expected) {
if (!actual.getName().equals(expected.getName())
|| actual.getParameters().equals(expected.getParameters())
|| actual.getModifiers() != expected.getModifiers()) {
|| !Arrays.equals(actual.getParameterTypes(), expected.getParameterTypes())
|| actual.getModifiers() != expected.getModifiers()
|| !actual.getReturnType().equals(expected.getReturnType())) {
return false;
}
return true;
Expand Down

0 comments on commit b929935

Please sign in to comment.