use of org.sonar.plugins.web.node.DirectiveNode in project sonar-web by SonarSource.
the class PageLexerTest method testDirectiveNode.
@Test
public void testDirectiveNode() {
String directive = "<!docTyPE html " + "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
DoctypeTokenizer tokenizer = new DoctypeTokenizer("<!DOCTYPE", ">");
List<Node> nodeList = new ArrayList<>();
CodeReader codeReader = new CodeReader(directive);
tokenizer.consume(codeReader, nodeList);
assertEquals(nodeList.size(), 1);
Node node = nodeList.get(0);
assertEquals(node.getClass(), DirectiveNode.class);
DirectiveNode directiveNode = (DirectiveNode) node;
assertEquals(4, directiveNode.getAttributes().size());
}
Aggregations