### Question:
XmlContentValidator implements ContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { DocumentBuilderAccessor.getDocumentBuilder().parse(stream); } catch (Exception e) { throw new InvalidContentException("Syntax violation for XML Schema artifact.", e); } } } XmlContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }### Answer:
@Test public void testValidSyntax() throws Exception { ContentHandle content = resourceToContentHandle("xml-valid.xml"); XsdContentValidator validator = new XsdContentValidator(); validator.validate(ValidityLevel.SYNTAX_ONLY, content); }
@Test public void testInvalidSyntax() throws Exception { ContentHandle content = resourceToContentHandle("xml-invalid-syntax.xml"); XsdContentValidator validator = new XsdContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.SYNTAX_ONLY, content); }); }