### Question:
XMLParser extends AbstractXMLParser { public static SushiEvent generateEventFromXML(String filePath) throws XMLParsingException { Document doc = readXMLDocument(filePath); return generateEvent(doc, null); }  static SushiEvent generateEventFromXML(String filePath); static SushiEvent generateEventFromXML(String filePath, String pathToXSD); static SushiEvent generateEventFromDoc(Document xmlDoc); static Node getFirstChildWithNameFromNode(String name, Node parentNode); static Node getLastChildWithNameFromNode(String name, Node parentNode); static List<Node> getAllChildWithNameFromNode(String name, Node parentNode);  }### Answer:
@Test public void testXMLParsing() throws XPathExpressionException, ParserConfigurationException, SAXException, IOException, XMLParsingException{ SushiEventType eventTyp = new SushiEventType("EventTaxonomy"); eventTyp.setXMLName("EventTaxonomy"); eventTyp.setTimestampName("timestamp"); eventTyp.save(); SushiEvent event = XMLParser.generateEventFromXML(filePath); assertNotNull(event); }
@Test public void testHierarchicalTimestampParsing() throws XMLParsingException { SushiEventType eventTyp = new SushiEventType("EventTaxonomy"); eventTyp.setXMLName("EventTaxonomy"); eventTyp.setTimestampName("location.timestamp"); eventTyp.save(); SushiEvent event = XMLParser.generateEventFromXML(filePathToXMLWithHierarchicalTimestamp); assertNotNull(event); Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(2013, 11, 25, 20, 25, 00); assertTrue("Should be " + cal.getTime() + " but was " + event.getTimestamp(), event.getTimestamp().equals(cal.getTime())); }
@Test public void testNonHierarchicalTimestampParsing() throws XMLParsingException { SushiEventType eventTyp = new SushiEventType("EventTaxonomy"); eventTyp.setXMLName("EventTaxonomy"); eventTyp.setTimestampName("timestamp"); eventTyp.save(); SushiEvent event = XMLParser.generateEventFromXML(filePathToXMLWithHierarchicalTimestamp); assertNotNull(event); Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(2013, 11, 24, 20, 25, 00); assertTrue("Should be " + cal.getTime() + " but was " + event.getTimestamp(), event.getTimestamp().equals(cal.getTime())); }