@Test public final void testValidateShouldValidateXMLWithXsd() throws SAXException, IOException { given(schema.newValidator()).willReturn(validator); given(domSourceFactory.newDOMSource(document)).willReturn(domSource); underTest.validate(document, schema); verify(validator).validate(domSource); }
@Override public void validate(final Document document, final Schema schema) { try { Validator validator = schema.newValidator(); validator.validate(domSourceFactory.newDOMSource(document)); } catch (Exception e) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - XSD validation failed.", e); } }
XsdStubDescriptorValidator implements StubDescriptorValidator { @Override public void validate(final Document document, final Schema schema) { try { Validator validator = schema.newValidator(); validator.validate(domSourceFactory.newDOMSource(document)); } catch (Exception e) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - XSD validation failed.", e); } } }
XsdStubDescriptorValidator implements StubDescriptorValidator { @Override public void validate(final Document document, final Schema schema) { try { Validator validator = schema.newValidator(); validator.validate(domSourceFactory.newDOMSource(document)); } catch (Exception e) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - XSD validation failed.", e); } }  }
XsdStubDescriptorValidator implements StubDescriptorValidator { @Override public void validate(final Document document, final Schema schema) { try { Validator validator = schema.newValidator(); validator.validate(domSourceFactory.newDOMSource(document)); } catch (Exception e) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - XSD validation failed.", e); } }  @Override void validate(final Document document, final Schema schema); }
XsdStubDescriptorValidator implements StubDescriptorValidator { @Override public void validate(final Document document, final Schema schema) { try { Validator validator = schema.newValidator(); validator.validate(domSourceFactory.newDOMSource(document)); } catch (Exception e) { throw new DescriptorValidationFailedException("Validation of stub descriptor failed - XSD validation failed.", e); } }  @Override void validate(final Document document, final Schema schema);  }