@Mock(reentrant = true) public boolean shouldRun(Filter filter, Object m) { testMethod = null; if (!coverageMap.isEmpty()) { if (m instanceof JUnit38ClassRunner) { boolean noTestsToRun = verifyTestMethodsInJUnit38TestClassThatShouldRun((JUnit38ClassRunner) m); if (noTestsToRun) { return false; } } else if (m instanceof FrameworkMethod) { testMethod = ((FrameworkMethod) m).getMethod(); Boolean shouldRun = shouldRunTestInCurrentTestRun(Test.class, testMethod); if (shouldRun != null) { return shouldRun; } } } Boolean shouldRun = MethodReflection.invoke(it, shouldRunMethod, filter, m); if (testMethod != null) { testMethods.put(testMethod, shouldRun); } return shouldRun; }
private Boolean shouldRunTestInCurrentTestRun( Class<? extends Annotation> testAnnotation, Method testMethod) { Boolean shouldRun = testMethods.get(testMethod); if (shouldRun != null) { return shouldRun; } if (isTestNotApplicableInCurrentTestRun(testAnnotation, testMethod)) { reportTestAsNotApplicableInCurrentTestRun(testMethod); testMethods.put(testMethod, false); return false; } return null; }