Skip to content

Commit

Permalink
Test if error message contains crucial information
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalasi committed May 18, 2023
1 parent 578b92a commit 4a38946
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tech.picnic.errorprone.bugpatterns;

import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.containsPattern;
import static com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers.SECOND;

import com.google.errorprone.BugCheckerRefactoringTestHelper;
Expand All @@ -11,10 +13,16 @@ final class MemberOrderingTest {
@Test
void identification() {
CompilationTestHelper.newInstance(MemberOrdering.class, getClass())
.expectErrorMessage(
"MemberOrdering",
and(
containsPattern("SuppressWarnings"),
containsPattern(
"Members, constructors and methods should follow standard ordering.")))
.addSourceLines(
"A.java",
"",
"// BUG: Diagnostic contains:",
"// BUG: Diagnostic matches: MemberOrdering",
"class A {",
" char a = 'a';",
" private static String FOO = \"foo\";",
Expand Down Expand Up @@ -57,7 +65,8 @@ void identification() {
"",
" class Inner {}",
" static class StaticInner {}",
"}");
"}")
.doTest();
}

@Test
Expand Down

0 comments on commit 4a38946

Please sign in to comment.