### Question:
AvoidMetaRefreshRule extends AbstractRule { @Override protected void applyTo(Page page, Violations violations) { for (HtmlMeta metaTag : page.findAllMetaTags()) { if ("refresh".equalsIgnoreCase(metaTag.getHttpEquivAttribute())) { violations.add(createViolation(metaTag, page, RULE_MESSAGE)); } } }  @Override String getName();  }### Answer:
@Test public void metaRefreshPresent() throws Exception { String content = "<html><head><meta http-equiv=\"refresh\" content=\"3; URL=page.htm\"></head><body><p>Redirecting</p></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void metaRefreshNotPresent() throws Exception { String content = "<html><head><title>No Refresh</title></head><body><p>Hello World</p></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations, rule); }