Skip to content

Commit

Permalink
Adding incorrect positive case does not cause tests to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoenig10 committed Jul 18, 2019
1 parent ccb7817 commit 863aeae
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public void testLogExceptionNotLastArg() {
@Test
public void testNoLogException() {
test(RuntimeException.class, "log.info(\"hello\");", Optional.of(errorMsg));

test(RuntimeException.class, "log.info(\"hello\", e);", Optional.of(errorMsg));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void testMustNotUseClassVariants() throws Exception {
positive("JsonTypeInfo.Id.MINIMAL_CLASS");
positive("com.fasterxml.jackson.annotation.JsonTypeInfo.Id.CLASS");
positive("com.fasterxml.jackson.annotation.JsonTypeInfo.Id.MINIMAL_CLASS");

positive("JsonTypeInfo.Id.NONE");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ public void positive() throws Exception {
failGuava(diagnostic, "Preconditions.checkArgument(param != \"string\", \"message {} {}\", 'a', 'b');");
failGuava(diagnostic, "Preconditions.checkState(param != \"string\", \"message {} {}\", 'a', 'b');");
failGuava(diagnostic, "Preconditions.checkNotNull(param, \"message {} {}\", 'a', 'b');");

failGuava(diagnostic, "Preconditions.checkNotNull(param, \"message\");");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public void positive() throws Exception {
failLogSafe(diagnostic,
"Preconditions.checkState(param != \"string\", String.format(\"constant %s\", param));");
failLogSafe(diagnostic, "Preconditions.checkNotNull(param, String.format(\"constant %s\", param));");

failLogSafe(diagnostic, "Preconditions.checkNotNull(param, \"constant\");");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ public void positive() throws Exception {
+ " UnsafeArg.of(\"char1\", 'a'), UnsafeArg.of(\"char2\", 'b'));");
failLogSafe(diagnostic, "Preconditions.checkNotNull(param, \"message %s %s\","
+ " UnsafeArg.of(\"char1\", 'a'), UnsafeArg.of(\"char2\", 'b'));");

failLogSafe(diagnostic, "Preconditions.checkNotNull(param, \"message\");");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void testNonCompileTimeConstantExpression() {
test("s + s");
test("\"world\" + s");
test("\"world\".substring(1)");

test("\"constant\"");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ public void positive() throws Exception {
"Preconditions.checkArgument(param != \"string\", String.format(\"constant %s\", param));");
failGuava(diagnostic, "Preconditions.checkState(param != \"string\", String.format(\"constant %s\", param));");
failGuava(diagnostic, "Preconditions.checkNotNull(param, String.format(\"constant %s\", param));");

failGuava(diagnostic, "Preconditions.checkNotNull(param, \"constant\");");
}
}

0 comments on commit 863aeae

Please sign in to comment.