From 6f7600966758d93be3b8d811b8c915577194e54b Mon Sep 17 00:00:00 2001 From: Eduard Shangareev Date: Thu, 27 Dec 2018 03:56:01 +0300 Subject: [PATCH] IGNITE-10828 GridAbstractTest calculates test count incorrectly --- .../testframework/junits/GridAbstractTest.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java index 600985cf5998d..97791c95e8ae7 100755 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java @@ -43,7 +43,6 @@ 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.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 int getNumberOfTests() { if (this0.forceTestCnt) cnt = this0.testCnt; - else { - BiPredicate> 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; }