Skip to content

Commit

Permalink
simple refactoring for preparing the after-case
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerdes committed Oct 28, 2015
1 parent cee980a commit ad52ad0
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -126,18 +126,18 @@ private void handleBeforeMethods(Class<?> testClass, Object testInstance) throws
}

private List<Method> findBeforeMethods(Class<?> testClass) {
return this.findMethodsForGivenAnnotation(testClass, Before.class);
}

Class<?> desiredAnnotation = Before.class;


private List<Method> findMethodsForGivenAnnotation(Class<?> testClass, Class<? extends Annotation> desiredAnnotation) {
List<Method> methods = new ArrayList<>();

//TODO port to streams
//TODO port to streams?
for(Method method: testClass.getDeclaredMethods()) {
for(Annotation annotation: method.getDeclaredAnnotations()) {
if (annotation.annotationType().equals(desiredAnnotation))
if (method.isAnnotationPresent(desiredAnnotation))
methods.add(method);
}
}

return methods;
Expand Down

0 comments on commit ad52ad0

Please sign in to comment.