### Question:
SchematronValidator { public void loadSchemas() { templates = new HashMap<>(); Templates isoSVRLTemplates = null; ClassPathResource svrlRes = new ClassPathResource( "/edu/unc/lib/dl/schematron/iso_svrl.xsl", SchematronValidator.class); Source svrlrc; try { svrlrc = new StreamSource(svrlRes.getInputStream()); } catch (IOException e1) { throw new Error("Cannot load iso_svrl.xsl", e1); } TransformerFactory factory = null; try { factory = createTransformerFactory(getClass()); isoSVRLTemplates = factory.newTemplates(svrlrc); } catch (TransformerFactoryConfigurationError e) { log.error("Error setting up transformer factory.", e); throw new Error("Error setting up transformer factory", e); } catch (TransformerConfigurationException e) { log.error("Error setting up transformer.", e); throw new Error("Error setting up transformer", e); } Transformer t = null; try { t = isoSVRLTemplates.newTransformer(); } catch (TransformerConfigurationException e) { throw new Error("There was a problem configuring the transformer.", e); } for (String schema : schemas.keySet()) { Resource resource = schemas.get(schema); Source schematron = null; try { schematron = new StreamSource(resource.getInputStream()); } catch (IOException e) { throw new Error("Cannot load resource for schema \"" + schema + "\" at " + resource.getDescription() + resource.toString()); } JDOMResult res = new JDOMResult(); try { t.transform(schematron, res); } catch (TransformerException e) { throw new Error( "Schematron issue: There were problems transforming Schematron to XSL.", e); } try { Templates schemaTemplates = factory .newTemplates(new JDOMSource(res.getDocument())); templates.put(schema, schemaTemplates); } catch (TransformerConfigurationException e) { throw new Error( "There was a problem configuring the transformer.", e); } } } SchematronValidator(); Map<String, Resource> getSchemas(); boolean hasFailedAssertions(Document svrl); boolean isValid(Resource resource, String schema); boolean isValid(Source source, String schema); void loadSchemas(); void setSchemas(Map<String, Resource> schemas); Document validate(Resource resource, String schema); Document validate(Source source, String schema); List<String> validateReportErrors(Source source, String schema); static List<String> parseSVRLErrors(Document svrl);  }### Answer:
@Test public void testLoadSchemas() { SchematronValidator sv = new SchematronValidator(); sv.loadSchemas(); ClassPathResource test = new ClassPathResource("simple_mets_profile.sch", SchematronValidator.class); sv.getSchemas().put("test", test); sv.loadSchemas(); sv.loadSchemas(); }