Search in sources :

Example 1 with BadShiftAmount

use of com.google.errorprone.bugpatterns.BadShiftAmount in project error-prone by google.

the class ErrorProneCompilerIntegrationTest method fileWithError.

@Test
public void fileWithError() throws Exception {
    Result exitCode = compiler.compile(compiler.fileManager().forResources(BadShiftAmount.class, "testdata/BadShiftAmountPositiveCases.java"));
    assertThat(outputStream.toString(), exitCode, is(Result.ERROR));
    Matcher<? super Iterable<Diagnostic<? extends JavaFileObject>>> matcher = hasItem(diagnosticMessage(containsString("[BadShiftAmount]")));
    assertTrue("Error should be found. " + diagnosticHelper.describe(), matcher.matches(diagnosticHelper.getDiagnostics()));
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Diagnostic(javax.tools.Diagnostic) BadShiftAmount(com.google.errorprone.bugpatterns.BadShiftAmount) Result(com.sun.tools.javac.main.Main.Result) Test(org.junit.Test)

Aggregations

BadShiftAmount (com.google.errorprone.bugpatterns.BadShiftAmount)1 Result (com.sun.tools.javac.main.Main.Result)1 Diagnostic (javax.tools.Diagnostic)1 JavaFileObject (javax.tools.JavaFileObject)1 Test (org.junit.Test)1