### Question:
XmlCompletionScanner { public static boolean isCompleteDocument(final File file) throws IOException { ErrorHandler handler = new ErrorHandler(file.getName()); try { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); final SAXParser parser = factory.newSAXParser(); parser.parse(file, handler); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } catch (SAXException e) { DeploymentScannerLogger.ROOT_LOGGER.debugf(e, "Exception parsing scanned XML document %s", file); return false; } return !handler.error; }  static boolean isCompleteDocument(final File file);  }### Answer:
@Test public void testCompleteDocument() throws Exception { handler.messages.clear(); File file = new File(XmlCompletionScannerTest.class.getClassLoader().getResource("loop-vdb.xml").toURI()); boolean result = XmlCompletionScanner.isCompleteDocument(file); assertThat(result, is(true)); }
@Test public void testIncompleteDocument() throws Exception { File file = new File(XmlCompletionScannerTest.class.getClassLoader().getResource("loop-vdb-error.xml").toURI()); boolean result = XmlCompletionScanner.isCompleteDocument(file); assertThat(result, is(false)); assertThat(handler.messages, is(not(nullValue()))); assertThat(handler.messages.size(), is(1)); String infoMessage = handler.messages.get(0); assertThat(infoMessage, is(DeploymentScannerLogger.ROOT_LOGGER.invalidXmlFileFound("loop-vdb-error.xml", 18, 7))); handler.messages.clear(); }