use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.
the class JspScriptletCheckTest method test.
@Test
public void test() throws Exception {
WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/jspScriptletCheck.html"), new JspScriptletCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Replace this scriptlet using tag libraries and expression language.").next().atLine(8);
}
use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.
the class LongJavaScriptCheckTest method custom.
@Test
public void custom() {
LongJavaScriptCheck check = new LongJavaScriptCheck();
check.maxLines = 4;
WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/LongJavaScriptCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(7).withCost(2d).withMessage("The length of this JS script (6) exceeds the maximum set to 4.");
}
use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.
the class UnifiedExpressionCheckTest method should_not_detect_unknown_functions_with_empty_list.
@Test
public void should_not_detect_unknown_functions_with_empty_list() {
UnifiedExpressionCheck check = new UnifiedExpressionCheck();
check.functions = "";
WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/UnifiedExpressionCheck.jsp"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(5);
}
use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.
the class UnifiedExpressionCheckTest method custom.
@Test
public void custom() {
UnifiedExpressionCheck check = new UnifiedExpressionCheck();
check.functions = "myMethod2,myMethod3";
WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/UnifiedExpressionCheck.jsp"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(2).withMessage("Fix this expression: Unknown function \"myMethod1\".").next().atLine(5).withMessage("Fix this expression: Error Parsing: ${}");
}
use of org.sonar.plugins.web.visitor.WebSourceCode in project sonar-web by SonarSource.
the class AbsoluteURICheckTest method detected.
@Test
public void detected() {
WebSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/absoluteURICheck.html"), new AbsoluteURICheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(3).withMessage("Replace this absolute URI \"href\" with a relative one, or move this absolute URI to a configuration file.").next().atLine(4).withMessage("Replace this absolute URI \"href\" with a relative one, or move this absolute URI to a configuration file.").next().atLine(7).withMessage("Replace this absolute URI \"src\" with a relative one, or move this absolute URI to a configuration file.").next().atLine(8).withMessage("Replace this absolute URI \"src\" with a relative one, or move this absolute URI to a configuration file.").next().atLine(9).withMessage("Replace this absolute URI \"src\" with a relative one, or move this absolute URI to a configuration file.");
}
Aggregations