### Question:
TitleForAbbreviationTagRule extends AbstractRule { @Override protected void applyTo(Page page, Violations violations) { for (HtmlAbbreviated abbr : page.findAllAbbreviationTags()) { if (!hasNonEmptyAttribute(abbr, "title")) { violations.add(createViolation(abbr, page, RULE_MESSAGE)); } } }  @Override String getName();  }### Answer:
@Test public void abbrElementWithTitleAttribute() throws Exception { String content = "<html><body><abbr title=\"Structured Query Language\">SQL</abbr></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations); }
@Test public void abbrElementWithEmptyTitleAttribute() throws Exception { String content = "<html><body><abbr title=\"\">SQL</abbr></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void abbrElementWithMissingTitleAttribute() { String content = "<html><body><abbr>SQL</abbr></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }