use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class UnifiedExpressionCheckTest method custom.
@Test
public void custom() {
UnifiedExpressionCheck check = new UnifiedExpressionCheck();
check.functions = "myMethod2,myMethod3";
HtmlSourceCode 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.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class AbsoluteURICheckTest method detected.
@Test
public void detected() {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/absoluteURICheck.html"), new AbsoluteURICheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(3, 0, 3, 30).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.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class AbsoluteURICheckTest method custom.
@Test
public void custom() {
AbsoluteURICheck check = new AbsoluteURICheck();
check.attributes = "img.src";
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/absoluteURICheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).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.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class DeprecatedAttributesInHtml5CheckTest method test.
@Test
public void test() {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/deprecatedAttributesInHtml5.html"), new DeprecatedAttributesInHtml5Check());
this.checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(3, 2, 3, 209).withMessage("Remove this deprecated \"CHARSET\" attribute.").next().atLine(3).withMessage("Remove this deprecated \"COORDS\" attribute.").next().atLine(3).withMessage("Remove this deprecated \"NAME\" attribute.").next().atLine(3).withMessage("Remove this deprecated \"SHAPE\" attribute.").next().atLine(6).withMessage("Remove this deprecated \"bordercolor\" attribute.").next().atLine(15).withMessage("Remove this deprecated \"code\" attribute.").next().atLine(18).withMessage("Remove this deprecated \"border\" attribute.").next().atLine(20).withMessage("Remove this deprecated \"name\" attribute.").next().atLine(22).withMessage("Remove this deprecated \"name\" attribute.").next().atLine(25).withMessage("Remove this deprecated \"align\" attribute.").next().atLine(27).withMessage("Remove this deprecated \"language\" attribute.").next().atLine(32).withMessage("Remove this deprecated \"[border]\" attribute.").next().atLine(33).withMessage("Remove this deprecated \"[datafld]\" attribute.").next().atLine(35).withMessage("Remove this deprecated \"[attr.datafld]\" attribute.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class FlashUsesBothObjectAndEmbedCheckTest method detected.
@Test
public void detected() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/FlashUsesBothObjectAndEmbedCheck.html"), new FlashUsesBothObjectAndEmbedCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(1, 0, 1, 86).withMessage("Add an <embed> tag within this <object> one.").next().atLine(5).next().atLine(9).next().atLocation(25, 0, 28, 67).withMessage("Surround this <embed> tag by an <object> one.").next().atLine(30).next().atLine(54);
}
Aggregations