### Question:
GrobidResponseStaxHandler implements StaxParserContentHandler { public GrobidResponse getResponse() { return response; }  @Override void onStartDocument(XMLStreamReader2 reader); @Override void onEndDocument(XMLStreamReader2 reader); @Override void onStartElement(XMLStreamReader2 reader); @Override void onEndElement(XMLStreamReader2 reader); @Override void onCharacter(XMLStreamReader2 reader); GrobidResponse getResponse();  }### Answer:
@Test public void testParsingPublication_shouldWork() throws Exception { InputStream inputStream = this.getClass().getResourceAsStream("/sample.grobid.xml"); XMLStreamReader2 reader = (XMLStreamReader2) inputFactory.createXMLStreamReader(inputStream); StaxUtils.traverse(reader, target); GrobidResponseStaxHandler.GrobidResponse structures = target.getResponse(); assertThat(structures.getAtitle(), is("This si the end of the world")); assertThat(structures.getFirstAuthor(), is("Foppiano")); }
@Test public void testParsingPublication2_shouldWork() throws Exception { InputStream inputStream = this.getClass().getResourceAsStream("/sample.grobid-2.xml"); XMLStreamReader2 reader = (XMLStreamReader2) inputFactory.createXMLStreamReader(inputStream); StaxUtils.traverse(reader, target); GrobidResponseStaxHandler.GrobidResponse structures = target.getResponse(); assertThat(structures.getFirstAuthorMonograph(), is("Gupta")); }
@Test public void testParsingPublication3_shouldWork() throws Exception { InputStream inputStream = this.getClass().getResourceAsStream("/sample.grobid-3.xml"); XMLStreamReader2 reader = (XMLStreamReader2) inputFactory.createXMLStreamReader(inputStream); StaxUtils.traverse(reader, target); GrobidResponseStaxHandler.GrobidResponse structures = target.getResponse(); assertThat(structures.getAtitle(), is("This si the end of the world")); assertThat(structures.getFirstAuthor(), is("Foppiano")); }