@Test
void hasAttribute()
{

    Document document =
        this.cleaner.clean(new StringReader("<html><head><body><p>test1</p><p class=\"myClass\">test2</p></body>"
            + "</html>"));
    List<Element> paragraphs = htmlFilter.filterDescendants(document.getDocumentElement(), new String[]{ "p" });
    assertEquals(2, paragraphs.size());
    assertFalse(htmlFilter.hasAttribute(paragraphs, "class", false));
    document =
        this.cleaner.clean(new StringReader("<html><head><body><p class=\"anotherClass\">test1</p>"
            + "<p class=\"myClass\">test2</p></body></html>"));
    paragraphs = htmlFilter.filterDescendants(document.getDocumentElement(), new String[]{ "p" });
    assertEquals(2, paragraphs.size());
    assertTrue(htmlFilter.hasAttribute(paragraphs, "class", false));
    assertFalse(htmlFilter.hasAttribute(paragraphs, "class", true));
    document =
        this.cleaner.clean(new StringReader("<html><head><body><p class=\"myClass\">test1</p>"
            + "<p class=\"myClass\">test2</p></body></html>"));
    paragraphs = htmlFilter.filterDescendants(document.getDocumentElement(), new String[]{ "p" });
    assertEquals(2, paragraphs.size());
    assertTrue(htmlFilter.hasAttribute(paragraphs, "class", true));
}