use of org.sonar.plugins.html.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);
assertThat(nodeList).hasSize(1);
Node node = nodeList.get(0);
assertThat(node).isInstanceOf(DirectiveNode.class);
assertThat(((DirectiveNode) node).getAttributes()).hasSize(4);
}
Aggregations