### Question:
AvoidServerSideImageMapRule extends AbstractRule { @Override protected void applyTo(Page page, Violations violations) { for (HtmlImage image : page.findAllImageTags()) { if (hasAttribute(image, "ismap")) { violations.add(createViolation(image, page, RULE_MESSAGE)); } } }  @Override String getName();  }### Answer:
@Test public void serverSideImageMapPresent() throws Exception { String content = "<html><body><img src=\"map.gif\" ismap=\"ismap\"/></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void clientSideImageMapPresent() throws Exception { String content = "<html><body><img src=\"map.gif\" usemap=\"somemap\" /></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations, rule); }
@Test public void normalImagePresent() throws Exception { String content = "<html><body><img src=\"image.gif\" /></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations, rule); }