예제 #1
0
 /** Test of processResource method, of class PathUtils. */
 public void testProcessResource() {
   System.out.println("processResource");
   // Tests of absolute and remotes
   assertEquals(
       "http://www.seznam.cz", PathUtils.processResource("http://www.seznam.cz", Paths.get("")));
   assertEquals(
       "https://a.b/q/w/e",
       PathUtils.processResource("https://a.b/q/w/e", Paths.get("some/context/file.lesscache")));
   assertEquals("/file", PathUtils.processResource("/file", Paths.get("")));
   assertEquals(
       "/abs/path/file",
       PathUtils.processResource("/abs/path/file", Paths.get("some/context/file.lesscache")));
   // Tests relative
   assertEquals(
       Paths.get("some/context/file.txt").toString(),
       PathUtils.processResource("file.txt", Paths.get("some/context")));
   assertEquals(
       Paths.get("some/context/file.txt").toString(),
       PathUtils.processResource("file.txt", Paths.get("some/context/")));
   assertEquals(
       Paths.get("some/file.txt").toString(),
       PathUtils.processResource("../file.txt", Paths.get("some/context")));
   assertEquals(
       Paths.get("../../file.txt").toString(),
       PathUtils.processResource("../file.txt", Paths.get("../")));
   assertEquals(
       Paths.get("../file.txt").toString(),
       PathUtils.processResource("file.txt", Paths.get("../")));
 }