use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_should_fail_when_using_incorrect_secondaryLocation2.
@Test
public void verify_should_fail_when_using_incorrect_secondaryLocation2() throws IOException {
IssuableSubscriptionVisitor visitor = new FakeVisitor().withDefaultIssues();
try {
JavaCheckVerifier.verify("src/test/files/JavaCheckVerifierIncorrectSecondaryLocation2.java", visitor);
Fail.fail("");
} catch (AssertionError e) {
assertThat(e).hasMessage("Secondary locations: expected: [5] unexpected:[]. In src/test/files/JavaCheckVerifierIncorrectSecondaryLocation2.java:10");
}
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method verify_with_provided_classes.
@Test
public void verify_with_provided_classes() {
IssuableSubscriptionVisitor visitor = new FakeVisitor().withDefaultIssues();
JavaCheckVerifier.verify(FILENAME_ISSUES, visitor, new ArrayList<File>());
}
use of org.sonar.plugins.java.api.IssuableSubscriptionVisitor in project sonar-java by SonarSource.
the class JavaCheckVerifierTest method should_fail_when_no_cost.
@Test
public void should_fail_when_no_cost() throws Exception {
IssuableSubscriptionVisitor visitor = new LinearFakeVisitor().withDefaultIssues();
try {
JavaCheckVerifier.verify(FILENAME_ISSUES, visitor);
Fail.fail("");
} catch (AssertionError e) {
assertThat(e).hasMessage("A cost should be provided for a rule with linear remediation function");
}
}
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]. In src/test/files/JavaCheckVerifierIncorrectSecondaryLocation.java:10");
}
}
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);
}
Aggregations