jdk/test/jdk/nio/zipfs/Basic.java
changeset 38568 f992c34c85b3
parent 37803 ac955d7f5271
--- a/jdk/test/jdk/nio/zipfs/Basic.java	Wed May 25 13:38:35 2016 -0700
+++ b/jdk/test/jdk/nio/zipfs/Basic.java	Wed May 25 13:53:03 2016 -0700
@@ -31,6 +31,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.ProviderMismatchException;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.StandardCopyOption;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -39,14 +40,15 @@
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
-
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
 /**
  * @test
- * @bug 8038500 8040059 8150366 8150496
+ * @bug 8038500 8040059 8150366 8150496 8147539
  * @summary Basic test for zip provider
  *
  * @run main Basic
  * @run main/othervm/java.security.policy=test.policy Basic
+ * @modules jdk.zipfs
  */
 
 public class Basic {
@@ -89,7 +91,7 @@
         found = false;
         try (DirectoryStream<Path> stream = Files.newDirectoryStream(fs.getPath("/"))) {
             for (Path entry: stream) {
-                found = entry.toString().equals("/META-INF/");
+                found = entry.toString().equals("/META-INF");
                 if (found) break;
             }
         }
@@ -117,6 +119,13 @@
         if (!store.supportsFileAttributeView("basic"))
             throw new RuntimeException("BasicFileAttributeView should be supported");
 
+        // Test: watch register should throw PME
+        try {
+            fs.getPath("/")
+              .register(FileSystems.getDefault().newWatchService(), ENTRY_CREATE);
+            throw new RuntimeException("watch service is not supported");
+        } catch (ProviderMismatchException x) { }
+
         // Test: ClosedFileSystemException
         fs.close();
         if (fs.isOpen())