Skip to content

Commit

Permalink
upgrade junit and address test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Coles committed Jan 4, 2023
1 parent 9fb2a34 commit e86ff28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
13 changes: 9 additions & 4 deletions pitest/src/test/java/org/pitest/TestJUnitConfiguration.java
@@ -1,5 +1,6 @@
package org.pitest;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
Expand Down Expand Up @@ -406,12 +407,14 @@ public void two() {
}

@Test
@Ignore
// Behaviour change junit 4.13 causes this to fail for reasons unknown. Other behavioural changes
// caused by this upgrade were tracked down to changes which causes the effected tests to also
// fail when not run via pitest. Given it is an obscure edge case will hopefully not cause any real issues.
public void shouldSplitTestInSuitesIntoSeperateUnitsWhenUsingNonStandardSuiteRunners() {
final List<TestUnit> actual = find(CustomSuite.class);

System.out.println(actual);

assertEquals(4, actual.size());
assertThat(actual).hasSize(4);

}

Expand Down Expand Up @@ -527,7 +530,9 @@ public JUnit3SuiteMethod(final String testName) {

public static junit.framework.Test suite() {
final TestSuite suite = new TestSuite();
suite.addTest(new JUnit3Test());
JUnit3Test t = new JUnit3Test();
t.setName("testSomething");
suite.addTest(t);
return suite;
}

Expand Down
10 changes: 8 additions & 2 deletions pitest/src/test/java/org/pitest/junit/RunnerSuiteFinderTest.java
Expand Up @@ -94,8 +94,14 @@ public JUnit3SuiteMethod(final String testName) {

public static junit.framework.Test suite() {
final TestSuite suite = new TestSuite();
suite.addTest(new One());
suite.addTest(new Two());
One one = new One();
one.setName("testSomething");
suite.addTest(one);

Two two = new Two();
two.setName("testSomething");

suite.addTest(two);
return suite;
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -28,7 +28,7 @@

<asm.version>9.4</asm.version>
<hamcrest.version>1.3</hamcrest.version>
<junit.version>4.11</junit.version>
<junit.version>4.13.1</junit.version>
<surefire.version>2.18.1</surefire.version> <!-- [2.19, 3.0.0-M7] seem to cause ASM-related test failures -->
<slf4j.version>1.7.12</slf4j.version>

Expand Down

0 comments on commit e86ff28

Please sign in to comment.