diff --git a/lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java b/lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java index 67e8a55aede..0cd18c5b5ec 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java @@ -45,9 +45,11 @@ public class TestMaxFailuresRule extends WithNestedTests { @Test public void testMaxFailures() { - int maxFailures = LuceneTestCase.ignoreAfterMaxFailures.getMaxFailures(); + int maxFailures = LuceneTestCase.ignoreAfterMaxFailures.maxFailures; + int failuresSoFar = LuceneTestCase.ignoreAfterMaxFailures.failuresSoFar; try { - LuceneTestCase.ignoreAfterMaxFailures.setMaxFailures(2); + LuceneTestCase.ignoreAfterMaxFailures.maxFailures = 2; + LuceneTestCase.ignoreAfterMaxFailures.failuresSoFar = 0; JUnitCore core = new JUnitCore(); final int [] assumptions = new int [1]; @@ -59,14 +61,16 @@ public class TestMaxFailuresRule extends WithNestedTests { }); Result result = core.run(Nested.class); - Assert.assertEquals(2, result.getFailureCount()); - Assert.assertEquals(0, result.getIgnoreCount()); Assert.assertEquals(100, result.getRunCount()); + Assert.assertEquals(0, result.getIgnoreCount()); + Assert.assertEquals(2, result.getFailureCount()); + // JUnit doesn't pass back the number of successful tests, just make sure // we did have enough assumption-failures. Assert.assertTrue(assumptions[0] > 50); } finally { - LuceneTestCase.ignoreAfterMaxFailures.setMaxFailures(maxFailures); + LuceneTestCase.ignoreAfterMaxFailures.maxFailures = maxFailures; + LuceneTestCase.ignoreAfterMaxFailures.failuresSoFar = failuresSoFar; } } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreAfterMaxFailures.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreAfterMaxFailures.java index aca4177d534..66667142808 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreAfterMaxFailures.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleIgnoreAfterMaxFailures.java @@ -37,14 +37,14 @@ import com.carrotsearch.randomizedtesting.annotations.Repeat; */ public final class TestRuleIgnoreAfterMaxFailures implements TestRule { /** - * Maximum failures. + * Maximum failures. Package scope for tests. */ - private int maxFailures; + int maxFailures; /** - * Current count of failures. + * Current count of failures. Package scope for tests. */ - private int failuresSoFar; + int failuresSoFar; /** * @param maxFailures @@ -70,7 +70,6 @@ public final class TestRuleIgnoreAfterMaxFailures implements TestRule { s.evaluate(); } catch (Throwable t) { if (!TestRuleMarkFailure.isAssumption(t)) { - System.out.println("#" + d); failuresSoFar++; } throw t; @@ -78,13 +77,4 @@ public final class TestRuleIgnoreAfterMaxFailures implements TestRule { } }; } - - /** For tests only. */ - void setMaxFailures(int maxFailures) { - this.maxFailures = maxFailures; - } - - int getMaxFailures() { - return maxFailures; - } }