StringURIResolver implements URIResolver { public Source resolve(final String href, final String base) throws TransformerException { final String s = documents.get(href); if (s != null) { return new StreamSource(new StringReader(s)); } return null; }  StringURIResolver put(final String href, final String document); Source resolve(final String href, final String base);  }
@Test public void testResolve_when_document_does_not_exist() throws TransformerException{ assertEquals(stringURIResolver.resolve("nonexist","base"),null); }
@Test public void testResolve_when_document_exists() throws TransformerException{ assertEquals(stringURIResolver.resolve("uri","base").getClass().getName(),"javax.xml.transform.stream.StreamSource"); }