### Question:
XMLIO { public Document parseXML ( final File xmlFile) throws ManipulationException { if ( xmlFile == null || !xmlFile.exists() ) { logger.error( "Unable to locate XML File {} ", xmlFile ); throw new ManipulationException( "XML file ({}) not found.", xmlFile); } Document doc; try { doc = builder.parse( xmlFile); } catch ( SAXException | IOException e ) { logger.error( "Unable to parse XML File", e ); throw new ManipulationException( "Unable to parse XML File", e ); } return doc; } XMLIO(); Document parseXML( final File xmlFile); void writeXML(File target, Document contents); String convert( Document contents );  }### Answer:
@Test public void modifyNotFoundFile () throws ManipulationException, XPathExpressionException { String tomcatPath = " Document doc = xmlIO.parseXML( xmlFile ); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.evaluate( tomcatPath, doc, XPathConstants.NODESET ); logger.debug( "Found node {} with size {} ", nodeList, nodeList.getLength() ); assertEquals( 0, nodeList.getLength() ); }
@Test public void testFindSingleInstance() throws ManipulationException, XPathExpressionException { Document doc = xmlIO.parseXML( xmlFile ); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.evaluate( " assertTrue( nodeList.getLength() != 0 ); }