changeset 13969:a0902e919673

Additional jmod test coverage
author chegar
date Mon, 07 Sep 2015 15:27:13 +0100
parents d4400a0c1a7f
children 4b89da98a8df
files test/jdk/jigsaw/tools/jmod/JmodNegativeTest.java test/jdk/jigsaw/tools/jmod/JmodTest.java
diffstat 2 files changed, 18 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/jigsaw/tools/jmod/JmodNegativeTest.java	Mon Sep 07 13:42:38 2015 +0100
+++ b/test/jdk/jigsaw/tools/jmod/JmodNegativeTest.java	Mon Sep 07 15:27:13 2015 +0100
@@ -361,6 +361,24 @@
         }
     }
 
+    @Test
+    public void testFileInModulePath() throws IOException {
+        Path jmod = MODS_DIR.resolve("output.jmod");
+        FileUtils.deleteFileIfExistsWithRetry(jmod);
+        Path file = MODS_DIR.resolve("testFileInModulePath.txt");
+        FileUtils.deleteFileIfExistsWithRetry(file);
+        Files.createFile(file);
+
+        jmod("create",
+             "--hash-dependencies", ".*",
+             "--modulepath", file.toString(),
+             jmod.toString())
+            .assertFailure()
+            .resultChecker(r ->
+                assertContains(r.output, "Error: path must be a directory")
+            );
+    }
+
     @DataProvider(name = "pathDoesNotExist")
     public Object[][] pathDoesNotExist() throws IOException {
         Path jmod = MODS_DIR.resolve("output.jmod");
--- a/test/jdk/jigsaw/tools/jmod/JmodTest.java	Mon Sep 07 13:42:38 2015 +0100
+++ b/test/jdk/jigsaw/tools/jmod/JmodTest.java	Mon Sep 07 15:27:13 2015 +0100
@@ -264,26 +264,6 @@
             );
     }
 
-    // TODO: rewrite
-//    @Test(enabled = false)
-//    public void testFileInModulePath() throws IOException {
-//        Path mod = helper.generateDefaultJModule("mod").assertSuccess();
-//
-//        String moduleName = "module";
-//        Path module = Paths.get(moduleName);
-//        Files.createDirectory(module);
-//        generateModuleInfo(module, new ModuleDescriptor.Builder(moduleName)
-//                                                       .requires("java.base")
-//                                                       .build());
-//        JImageGenerator
-//                .getJModTask()
-//                .addClassPath(module)
-//                .hashDependencies(".*")
-//                .addJmods(mod)
-//                .jmod(Paths.get("output.jmod"))
-//                .create().assertSuccess();
-//    }
-
     // ---
 
     static boolean compileModule(String name, Path dest) throws IOException {