Skip to content

Commit 54bc491

Browse files
klueverError Prone Team
authored andcommitted
PUBLIC: Stop flagging @Ignore on JUnit3 tests. Internally, we've made our legacy JUnit3 runner skip tests with @Ignore (unknown commit). Externally, basically nobody uses JUnit3 anymore (and if someone does make this mistake, they'll quickly notice anyways).
PiperOrigin-RevId: 945750863
1 parent c8511ce commit 54bc491

2 files changed

Lines changed: 1 addition & 44 deletions

File tree

core/src/main/java/com/google/errorprone/bugpatterns/JUnit4ClassUsedInJUnit3.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public Description matchAnnotation(AnnotationTree tree, VisitorState state) {
6666
if (!enclosingClass(isJUnit3TestClass).matches(tree, state)) {
6767
return NO_MATCH;
6868
}
69-
// If we are inside a JUnit3 test class some annotation should not appear.
70-
if (isType("org.junit.Ignore").matches(tree, state)) {
71-
return makeDescription("@Ignore", tree);
72-
}
69+
// If we are inside a JUnit3 test class some annotations should not appear.
7370
if (isType("org.junit.Rule").matches(tree, state)) {
7471
return makeDescription("@Rule", tree);
7572
}

core/src/test/java/com/google/errorprone/bugpatterns/JUnit4ClassUsedInJUnit3Test.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -197,46 +197,6 @@ public void testName3() {}
197197
.doTest();
198198
}
199199

200-
@Test
201-
public void positive_ignore_on_test() {
202-
compilationHelper
203-
.addSourceLines(
204-
"Foo.java",
205-
"""
206-
import junit.framework.TestCase;
207-
import org.junit.Ignore;
208-
209-
public class Foo extends TestCase {
210-
public void testName1() {}
211-
212-
// BUG: Diagnostic contains: @Ignore
213-
@Ignore
214-
public void testName2() {}
215-
}
216-
""")
217-
.doTest();
218-
}
219-
220-
@Test
221-
public void positive_ignore_on_class() {
222-
compilationHelper
223-
.addSourceLines(
224-
"Foo.java",
225-
"""
226-
import junit.framework.TestCase;
227-
import org.junit.Ignore;
228-
229-
// BUG: Diagnostic contains: @Ignore
230-
@Ignore
231-
public class Foo extends TestCase {
232-
public void testName1() {}
233-
234-
public void testName2() {}
235-
}
236-
""")
237-
.doTest();
238-
}
239-
240200
@Test
241201
public void positive_rule_in_junit3() {
242202
compilationHelper

0 commit comments

Comments
 (0)