jdk/test/demo/zipfs/PathOps.java
changeset 8005 5bc99c45810a
parent 6699 d8229570529d
child 8165 b67d8b1f4e46
equal deleted inserted replaced
8004:11f3cdd5c639 8005:5bc99c45810a
   188 
   188 
   189     PathOps string(String expected) {
   189     PathOps string(String expected) {
   190         out.println("check string representation");
   190         out.println("check string representation");
   191         checkPath();
   191         checkPath();
   192         check(path, expected);
   192         check(path, expected);
       
   193         return this;
       
   194     }
       
   195 
       
   196     PathOps isSameFile(String target) {
       
   197         try {
       
   198             out.println("check two paths are same");
       
   199             checkPath();
       
   200             check(path.isSameFile(test(target).path()), true);
       
   201         } catch (IOException ioe) {
       
   202             fail();
       
   203         }
   193         return this;
   204         return this;
   194     }
   205     }
   195 
   206 
   196     PathOps invalid() {
   207     PathOps invalid() {
   197         if (!(exc instanceof InvalidPathException)) {
   208         if (!(exc instanceof InvalidPathException)) {
   342             .normalize("foo");
   353             .normalize("foo");
   343         test("foo/bar/gus/../..")
   354         test("foo/bar/gus/../..")
   344             .normalize("foo");
   355             .normalize("foo");
   345         test("/foo/bar/gus/../..")
   356         test("/foo/bar/gus/../..")
   346             .normalize("/foo");
   357             .normalize("/foo");
   347 
   358         test("/./.")
       
   359             .normalize("/");
       
   360         test("/.")
       
   361             .normalize("/");
       
   362         test("/./abc")
       
   363             .normalize("/abc");
   348         // invalid
   364         // invalid
   349         test("foo\u0000bar")
   365         test("foo\u0000bar")
   350             .invalid();
   366             .invalid();
   351         test("\u0000foo")
   367         test("\u0000foo")
   352             .invalid();
   368             .invalid();
   363         test("//foo//bar")
   379         test("//foo//bar")
   364             .string("/foo/bar")
   380             .string("/foo/bar")
   365             .root("/")
   381             .root("/")
   366             .parent("/foo")
   382             .parent("/foo")
   367             .name("bar");
   383             .name("bar");
       
   384 
       
   385         // isSameFile
       
   386         test("/fileDoesNotExist")
       
   387             .isSameFile("/fileDoesNotExist");
   368     }
   388     }
   369 
   389 
   370     static void npes() {
   390     static void npes() {
   371         header("NullPointerException");
   391         header("NullPointerException");
   372 
   392