+
+ /**
+ * Resolves an existing file. Verifies the file is resolved correctly.
+ *
+ * @throws TransformerException
+ * @throws IOException
+ */
+ public void testResolveExistingFileLSResourceResolver()
+ throws TransformerException, IOException {
+ LSInput source = resolver.resolveResource(null, null, "kees",
+ EXISTING_RESOURCE, null);
+ assertNotNull(source);
+
+ assertEquals("kees", source.getPublicId());
+ assertEquals(EXISTING_RESOURCE, source.getSystemId());
+
+ String resolved = FileSystemUtils.read(source.getByteStream());
+
+ ClassPathResource resource = new ClassPathResource(
+ EXISTING_RESOURCE);
+ String expected = FileSystemUtils.read(resource.getInputStream());
+ assertEquals(expected, resolved);
+ }
+
+ /**
+ * Resolves a non-existing file. Verifies that a TransformerException is
+ * thrown.
+ *
+ */
+ public void testResolveNonExistingFileLSResourceResolver() {
+ LSInput input = resolver.resolveResource(null, null, "kees",
+ NON_EXISTING_RESOURCE, null);
+ assertNull(input);
+ }