Skip to content

Commit b1631fe

Browse files
graememorganError Prone Team
authored andcommitted
Enable some ignored tests which pass.
(And hardcode class names so we can use text blocks.) PiperOrigin-RevId: 850747775
1 parent 3ea92c5 commit b1631fe

File tree

1 file changed

+66
-51
lines changed

1 file changed

+66
-51
lines changed

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

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.common.collect.ImmutableList;
2222
import com.google.errorprone.BugCheckerRefactoringTestHelper;
2323
import com.google.errorprone.CompilationTestHelper;
24-
import org.junit.Ignore;
2524
import org.junit.Test;
2625
import org.junit.runner.RunWith;
2726
import org.junit.runners.JUnit4;
@@ -516,28 +515,33 @@ public void innerClassNegative() {
516515
testHelper
517516
.addSourceLines(
518517
"Test.java",
519-
"import " + InnerClassTest.class.getCanonicalName() + ";",
520-
"class Test {",
521-
" {",
522-
" new InnerClassTest().new Inner(/* foo= */ 1, /* bar= */ 2);",
523-
" }",
524-
"}")
518+
"""
519+
import com.google.errorprone.bugpatterns.ParameterNameTest.InnerClassTest;
520+
521+
class Test {
522+
{
523+
new InnerClassTest().new Inner(/* foo= */ 1, /* bar= */ 2);
524+
}
525+
}
526+
""")
525527
.doTest();
526528
}
527529

528-
@Ignore // see b/64954766
529530
@Test
530531
public void innerClassPositive() {
531532
testHelper
532533
.addSourceLines(
533534
"Test.java",
534-
"import " + InnerClassTest.class.getCanonicalName() + ";",
535-
"class Test {",
536-
" {",
537-
" // BUG: Diagnostic contains:",
538-
" new InnerClassTest().new Inner(/* bar= */ 1, /* foo= */ 2);",
539-
" }",
540-
"}")
535+
"""
536+
import com.google.errorprone.bugpatterns.ParameterNameTest.InnerClassTest;
537+
538+
class Test {
539+
{
540+
// BUG: Diagnostic contains:
541+
new InnerClassTest().new Inner(/* bar= */ 1, /* foo= */ 2);
542+
}
543+
}
544+
""")
541545
.doTest();
542546
}
543547

@@ -551,30 +555,33 @@ public void anonymousClassConstructorNegative() {
551555
testHelper
552556
.addSourceLines(
553557
"Test.java",
554-
"import " + Foo.class.getCanonicalName() + ";",
555-
"class Test {",
556-
" {",
557-
" new Foo(/* foo= */ 1, /* bar= */ 2) {",
558-
" };",
559-
" }",
560-
"}")
558+
"""
559+
import com.google.errorprone.bugpatterns.ParameterNameTest.Foo;
560+
561+
class Test {
562+
{
563+
new Foo(/* foo= */ 1, /* bar= */ 2) {};
564+
}
565+
}
566+
""")
561567
.doTest();
562568
}
563569

564-
@Ignore // see b/65065109
565570
@Test
566571
public void anonymousClassConstructor() {
567572
testHelper
568573
.addSourceLines(
569574
"Test.java",
570-
"import " + Foo.class.getCanonicalName() + ";",
571-
"class Test {",
572-
" {",
573-
" // BUG: Diagnostic contains:",
574-
" new Foo(/* bar= */ 1, /* foo= */ 2) {",
575-
" };",
576-
" }",
577-
"}")
575+
"""
576+
import com.google.errorprone.bugpatterns.ParameterNameTest.Foo;
577+
578+
class Test {
579+
{
580+
// BUG: Diagnostic contains:
581+
new Foo(/* bar= */ 1, /* foo= */ 2) {};
582+
}
583+
}
584+
""")
578585
.doTest();
579586
}
580587

@@ -636,28 +643,33 @@ public void externalAnnotatedParameterNegative() {
636643
testHelper
637644
.addSourceLines(
638645
"Test.java",
639-
"import " + AnnotatedParametersTestClass.class.getCanonicalName() + ";",
640-
"class Test {",
641-
" void test() {",
642-
" AnnotatedParametersTestClass.target(/* foo= */ 1);",
643-
" }",
644-
"}")
646+
"""
647+
import com.google.errorprone.bugpatterns.ParameterNameTest.AnnotatedParametersTestClass;
648+
649+
class Test {
650+
void test() {
651+
AnnotatedParametersTestClass.target(/* foo= */ 1);
652+
}
653+
}
654+
""")
645655
.doTest();
646656
}
647657

648-
@Ignore // TODO(b/67993065): remove @Ignore after the issue is fixed.
649658
@Test
650659
public void externalAnnotatedParameterPositive() {
651660
testHelper
652661
.addSourceLines(
653662
"Test.java",
654-
"import " + AnnotatedParametersTestClass.class.getCanonicalName() + ";",
655-
"class Test {",
656-
" void test() {",
657-
" // BUG: Diagnostic contains: target(/* foo= */ 1)",
658-
" AnnotatedParametersTestClass.target(/* bar= */ 1);",
659-
" }",
660-
"}")
663+
"""
664+
import com.google.errorprone.bugpatterns.ParameterNameTest.AnnotatedParametersTestClass;
665+
666+
class Test {
667+
void test() {
668+
// BUG: Diagnostic contains: target(/* foo= */ 1)
669+
AnnotatedParametersTestClass.target(/* bar= */ 1);
670+
}
671+
}
672+
""")
661673
.doTest();
662674
}
663675

@@ -897,12 +909,15 @@ public void varargsSeparateCompilation() {
897909
testHelper
898910
.addSourceLines(
899911
"Test.java",
900-
"import " + Holder.class.getCanonicalName() + ";",
901-
"class Test {",
902-
" void bar() {",
903-
" Holder.varargsMethod(/* values...= */ 1, 1, 1);",
904-
" }",
905-
"}")
912+
"""
913+
import com.google.errorprone.bugpatterns.ParameterNameTest.Holder;
914+
915+
class Test {
916+
void bar() {
917+
Holder.varargsMethod(/* values...= */ 1, 1, 1);
918+
}
919+
}
920+
""")
906921
.withClasspath(Holder.class, ParameterNameTest.class)
907922
.doTest();
908923
}

0 commit comments

Comments
 (0)