Search in sources :

Example 1 with NullDereferenceCheck

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

the class CheckerDispatcherTest method test_only_one_execution_of_post_statement_by_check.

@Test
public void test_only_one_execution_of_post_statement_by_check() {
    List<SECheck> checks = Lists.newArrayList(new NullDereferenceCheck(), new CheckTest(), new CheckTest(), new CheckTest());
    CheckerDispatcher checkerDispatcher = new CheckerDispatcher(mockExplodedGraphWalker(), checks);
    checkerDispatcher.executeCheckPostStatement(mock(Tree.class));
    for (SECheck check : checks) {
        if (check instanceof CheckTest) {
            assertThat(((CheckTest) check).postStatementExecution).isEqualTo(1);
        }
    }
}
Also used : SECheck(org.sonar.java.se.checks.SECheck) NullDereferenceCheck(org.sonar.java.se.checks.NullDereferenceCheck) Tree(org.sonar.plugins.java.api.tree.Tree) Test(org.junit.Test)

Example 2 with NullDereferenceCheck

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

the class RelationalSymbolicValueTest method too_many_relationship_should_stop_se_engine.

@Test
public void too_many_relationship_should_stop_se_engine() throws Exception {
    SETestUtils.createSymbolicExecutionVisitor("src/test/files/se/ExceedTransitiveLimit.java", new NullDereferenceCheck());
    assertThat(logTester.logs(LoggerLevel.DEBUG)).contains("Could not complete symbolic execution: ");
}
Also used : NullDereferenceCheck(org.sonar.java.se.checks.NullDereferenceCheck) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 NullDereferenceCheck (org.sonar.java.se.checks.NullDereferenceCheck)2 SECheck (org.sonar.java.se.checks.SECheck)1 Tree (org.sonar.plugins.java.api.tree.Tree)1