### Question:
OrderedListContainsListItemsRule extends AbstractRule { @Override protected void applyTo(Page page, Violations violations) { List<HtmlOrderedList> orderedLists = page.findAllOrderedLists(); for (HtmlOrderedList orderedList : orderedLists) { if (!listHasOneOrMoreListItems(orderedList)) { violations.add(createViolation(orderedList, page, RULE_MESSAGE)); } } }  @Override String getName();  }### Answer:
@Test public void orderedListWithoutItems() throws Exception { String content = "<html><body><ol></ol></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 1); }
@Test public void orderedListContainingToOrderedListsWithoutItems() throws Exception { String content = "<html><body><ol><li><ol></ol></li><li><ol></ol></li></ol></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertViolations(violations, rule, 2); }
@Test public void orderedListWithItems() throws Exception { String content = "<html><body><ol><li>First item</li></ol></body></html>"; Violations violations = rule.applyTo(toHtmlPage(content)); assertNoViolations(violations); }