### Question:
AlternativeTextForInlineFrameRule extends AbstractRule { @Override protected void applyTo(Page page, Violations violations) { for (HtmlInlineFrame inlineFrame : page.findAllInlineFrameTags()) { if (inlineFrame.getTextContent() == null || inlineFrame.getTextContent().trim().isEmpty()) { violations.add(createViolation(inlineFrame, page, RULE_MESSAGE)); } } }  @Override String getName();  }### Answer:
@Test public void innerFrameWithAlternativeTextMissing() throws Exception { String content = "<html><body><iframe src=\"correct-url.html\"></iframe></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void innerFrameWithAlternativeEmptyTextPresent() throws Exception { String content = "<html><body><iframe src=\"correct-url.html\"> </iframe></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void innerFrameWithAlternativeLinkPresent() throws Exception { String content = "<html><body><iframe src=\"correct.htm\"><a href=\"alternative.htm\">Alternative URL</a></iframe></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations, rule); }