Search in sources :

Example 1 with JavaCheckVerifier

use of org.sonar.java.se.JavaCheckVerifier in project sonar-java by SonarSource.

the class FlowComputationTest method test_flows_with_single_msg_not_reported.

@Test
public void test_flows_with_single_msg_not_reported() throws Exception {
    JavaCheckVerifier noFlowsVerifier = new JavaCheckVerifier() {

        @Override
        protected void checkIssues(Set<AnalyzerMessage> issues) {
            assertThat(issues).hasSize(4);
            issues.forEach(issue -> assertThat(issue.flows.stream().allMatch(List::isEmpty)).as("No flows expected, but %s was reported.", issue.flows).isTrue());
        }
    };
    noFlowsVerifier.scanFile("src/test/files/se/FlowsWithSingleMsg.java", new SECheck[] { new NullDereferenceCheck(), new ConditionalUnreachableCodeCheck(), new BooleanGratuitousExpressionsCheck(), new DivisionByZeroCheck() });
}
Also used : Set(java.util.Set) List(java.util.List) JavaCheckVerifier(org.sonar.java.se.JavaCheckVerifier) Test(org.junit.Test)

Aggregations

List (java.util.List)1 Set (java.util.Set)1 Test (org.junit.Test)1 JavaCheckVerifier (org.sonar.java.se.JavaCheckVerifier)1