+++ /dev/null
-/*--------------------------------------------------------------------------\r
- * Copyright 2008 Taro L. Saito\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// ResourcePathTest.java\r
-// Since: Oct 30, 2008 9:38:38 AM\r
-//\r
-// $URL: http://www.xerial.org/svn/project/XerialJ/trunk/xerial-core/src/test/java/org/xerial/util/ResourcePathTest.java $\r
-// $Author: leo $\r
-//--------------------------------------\r
-package org.xerial.util;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.IOException;\r
-import java.net.URL;\r
-\r
-import org.junit.After;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.xerial.core.XerialException;\r
-\r
-public class ResourcePathTest\r
-{\r
-\r
- @Before\r
- public void setUp() throws Exception\r
- {}\r
-\r
- @After\r
- public void tearDown() throws Exception\r
- {}\r
-\r
- @Test\r
- public void testGetURL() throws XerialException, IOException\r
- {\r
- ResourcePath rp = new ResourcePath(ResourcePathTest.class, "test-resource.txt");\r
- URL u = rp.getURL();\r
- assertNotNull(u);\r
-\r
- assertEquals("org/xerial/util/test-resource.txt", rp.getPath());\r
-\r
- BufferedReader reader = rp.openCharacterStream();\r
- for (String line = reader.readLine(); line != null; line = reader.readLine())\r
- {\r
-\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void jarResource()\r
- {\r
- ResourcePath rp = new ResourcePath(Package.getPackage("org.junit"), "Test.class");\r
- URL u = rp.getURL();\r
- assertNotNull(u);\r
-\r
- assertEquals("org/junit/Test.class", rp.getPath());\r
-\r
- }\r
-\r
- @Test\r
- public void fullPath()\r
- {\r
- ResourcePath rp = new ResourcePath("org/xerial/util/test-resource.txt");\r
- URL u = rp.getURL();\r
- assertNotNull(u);\r
-\r
- assertEquals("org/xerial/util/test-resource.txt", rp.getPath());\r
-\r
- }\r
-\r
-}\r