X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=support%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fxml%2FClasspathUriResolverTest.java;fp=support%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fxml%2FClasspathUriResolverTest.java;h=0000000000000000000000000000000000000000;hb=32a62ca2c752e33a7873ac868a7a1f289caedcd4;hp=7ea41ba2ab8322213200747bc409bce20f613426;hpb=d2bdf4e813c6a3964958c87b2ce56eaadf8a1f0a;p=utils diff --git a/support/src/test/java/org/wamblee/xml/ClasspathUriResolverTest.java b/support/src/test/java/org/wamblee/xml/ClasspathUriResolverTest.java deleted file mode 100644 index 7ea41ba2..00000000 --- a/support/src/test/java/org/wamblee/xml/ClasspathUriResolverTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wamblee.xml; - -import java.io.IOException; - -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.URIResolver; -import javax.xml.transform.stream.StreamSource; - -import junit.framework.TestCase; - -import org.springframework.core.io.ClassPathResource; -import org.wamblee.io.FileSystemUtils; - -/** - * Tests for {@link org.wamblee.xml.ClasspathUriResolver}. - * - * @author Erik Brakkee - */ -public class ClasspathUriResolverTest extends TestCase { - - private URIResolver _resolver; - - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - _resolver = new ClasspathUriResolver(); - } - - /** - * Resolves an existing file. Verifies the file is resolved correctly. - * @throws TransformerException - * @throws IOException - */ - public void testResolveExistingFile() throws TransformerException, IOException { - Source source = _resolver.resolve("org/wamblee/xml/reportToHtml.xsl", ""); - assertTrue(source instanceof StreamSource); - String resolved = FileSystemUtils.read(((StreamSource)source).getInputStream()); - - ClassPathResource resource = new ClassPathResource("org/wamblee/xml/reportToHtml.xsl"); - String expected = FileSystemUtils.read(resource.getInputStream()); - assertEquals(expected, resolved); - } - - /** - * Resolves a non-existing file. Verifies that a TransformerException is thrown. - * - */ - public void testResolveNonExistingFile() { - try { - Source source = _resolver.resolve("org/wamblee/xml/reportToHtml-nonexisting.xsl", ""); - } catch (TransformerException e) { - return; // ok - } - fail(); - } -}