Add test and refactor some code of the MethodMatcher