XMLPagesParser extends AbstractXMLParser { public List<String> getWarnings() { if (warnings == null) { return Collections.emptyList(); } else { return warnings; } } XMLPagesParser(String xmlText); @Override void startElement(String namespaceURI, String localName, String qName, Attributes atts); @Override void endElement(String uri, String name, String qName); List<Page> getPagesList(); List<String> getWarnings();  }
@Test public void testParsePageWithWarnings() throws Exception { XMLPagesParser parser = new XMLPagesParser(xml("fooPageWithWarning")); parser.parse(); assertThat(parser.getWarnings()).containsExactly("This is a warning"); }