GridAbstractTest calculates test count incorrectly - Fixes
@@ -43,7 +43,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.function.BiPredicate;
import javax.cache.configuration.Factory;
import javax.cache.configuration.FactoryBuilder;
import org.apache.ignite.Ignite;
@@ -128,6 +127,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runners.model.Statement;
+import org.junit.runners.model.TestClass;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
@@ -2591,16 +2591,12 @@ public abstract class GridAbstractTest extends JUnit3TestLegacySupport {
if (this0.forceTestCnt)
cnt = this0.testCnt;
- else {
- BiPredicate<Method, Class<? extends Annotation>> annotated
- = (m, cls) -> m.getAnnotation(cls) != null;
-
- cnt = 0;
-
- for (Method m : this0.getClass().getMethods())
- if (annotated.test(m, Test.class) && !annotated.test(m, Ignore.class))
- cnt++;
- }
+ else
+ cnt = (int)new TestClass(this0.getClass())
+ .getAnnotatedMethods(Test.class)
+ .stream()
+ .filter(method -> method.getAnnotation(Ignore.class) == null)
+ .count();
numOfTests = cnt;
}
