@Test public void validateErMineralOccurrenceWithErrors() { try { AppSchemaValidator.validateResource( "/test-data/er_MineralOccurrence_with_errors.xml", null); Assert.fail( "Unexpected schema validation success for known-invalid XML instance document"); } catch (Exception e) { Assert.assertTrue( e.getMessage(), e.getMessage() .startsWith( "Schema validation failures: 2" + System.getProperty("line.separator"))); } }
public static void validateResource(String name, SchemaCatalog catalog) { InputStream input = null; try { input = AppSchemaValidator.class.getResourceAsStream(name); validate(input, catalog); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } }
AppSchemaValidator { public static void validateResource(String name, SchemaCatalog catalog) { InputStream input = null; try { input = AppSchemaValidator.class.getResourceAsStream(name); validate(input, catalog); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } }
AppSchemaValidator { public static void validateResource(String name, SchemaCatalog catalog) { InputStream input = null; try { input = AppSchemaValidator.class.getResourceAsStream(name); validate(input, catalog); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(SchemaResolver resolver); private  AppSchemaValidator(SchemaCatalog catalog); }
AppSchemaValidator { public static void validateResource(String name, SchemaCatalog catalog) { InputStream input = null; try { input = AppSchemaValidator.class.getResourceAsStream(name); validate(input, catalog); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(SchemaResolver resolver); private  AppSchemaValidator(SchemaCatalog catalog); List<String> getFailures(); boolean isFailOnWarning(); void setFailOnWarning(boolean failOnWarning); void parse(InputStream input); void checkForFailures(); static AppSchemaValidator buildValidator(); static AppSchemaValidator buildValidator(SchemaResolver resolver); static AppSchemaValidator buildValidator(SchemaCatalog catalog); static void validateResource(String name, SchemaCatalog catalog); static void validate(String xml, SchemaCatalog catalog); static void validate(InputStream input, SchemaCatalog catalog); }
AppSchemaValidator { public static void validateResource(String name, SchemaCatalog catalog) { InputStream input = null; try { input = AppSchemaValidator.class.getResourceAsStream(name); validate(input, catalog); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(SchemaResolver resolver); private  AppSchemaValidator(SchemaCatalog catalog); List<String> getFailures(); boolean isFailOnWarning(); void setFailOnWarning(boolean failOnWarning); void parse(InputStream input); void checkForFailures(); static AppSchemaValidator buildValidator(); static AppSchemaValidator buildValidator(SchemaResolver resolver); static AppSchemaValidator buildValidator(SchemaCatalog catalog); static void validateResource(String name, SchemaCatalog catalog); static void validate(String xml, SchemaCatalog catalog); static void validate(InputStream input, SchemaCatalog catalog);  }