use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_missing_expected_issue.
@Test
public void verify_missing_expected_issue() {
IssuableSubscriptionVisitor visitor = new FakeVisitor().withDefaultIssues().withoutIssue(1);
try {
JavaCheckVerifier.verify(FILENAME_ISSUES, visitor);
Fail.fail("");
} catch (AssertionError e) {
assertThat(e).hasMessage("Expected at [1]");
}
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_issue_on_file.
@Test
public void verify_issue_on_file() {
String expectedMessage = "messageOnFile";
IssuableSubscriptionVisitor visitor = new FakeVisitor().withIssueOnFile(expectedMessage);
JavaCheckVerifier.verifyIssueOnFile(FILENAME_ISSUES, expectedMessage, visitor);
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_should_fail_when_using_incorrect_secondaryLocation.
@Test
public void verify_should_fail_when_using_incorrect_secondaryLocation() throws IOException {
IssuableSubscriptionVisitor visitor = new FakeVisitor().withDefaultIssues();
try {
JavaCheckVerifier.verify("src/test/files/JavaCheckVerifierIncorrectSecondaryLocation.java", visitor);
Fail.fail("");
} catch (AssertionError e) {
assertThat(e).hasMessage("Secondary locations: expected: [] unexpected:[3]");
}
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method test_with_no_semantic_and_java_version.
@Test
public void test_with_no_semantic_and_java_version() throws Exception {
int java_8 = 8;
IssuableSubscriptionVisitor noIssueVisitor = new FakeVisitor();
JavaCheckVerifier.verifyNoIssueWithoutSemantic(FILENAME_ISSUES, noIssueVisitor, java_8);
JavaCheckVerifier.verifyNoIssueWithoutSemantic(FILENAME_NO_ISSUE, noIssueVisitor, java_8);
try {
JavaCheckVerifier.verifyNoIssueWithoutSemantic(FILENAME_ISSUES, new FakeVisitor().withDefaultIssues(), java_8);
Fail.fail("");
} catch (AssertionError e) {
assertThat(e.getMessage()).contains("No issues expected but got:");
}
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_line_issues.
@Test
public void verify_line_issues() {
IssuableSubscriptionVisitor visitor = new FakeVisitor().withDefaultIssues();
JavaCheckVerifier.verify(FILENAME_ISSUES, visitor);
}
Aggregations