< prev index next >

test/java/lang/module/ModuleFinderTest.java

Print this page

        

@@ -371,11 +371,11 @@
         assertTrue(descriptor.packages().contains("p.resources"));
     }
 
 
     /**
-     * Test ModuleModule with a JAR file containing a .class file in the top
+     * Test ModuleFinder with a JAR file containing a .class file in the top
      * level directory.
      */
     public void testOfOneJarFileWithTopLevelClass() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mods");
         Path jar = createModularJar(dir.resolve("m.jar"), "m", "Mojo.class");

@@ -384,23 +384,25 @@
         try {
             finder.find("m");
             assertTrue(false);
         } catch (FindException e) {
             assertTrue(e.getCause() instanceof InvalidModuleDescriptorException);
+            assertTrue(e.getCause().getMessage().contains("Mojo.class"));
         }
 
         finder = ModuleFinder.of(jar);
         try {
             finder.findAll();
             assertTrue(false);
         } catch (FindException e) {
             assertTrue(e.getCause() instanceof InvalidModuleDescriptorException);
+            assertTrue(e.getCause().getMessage().contains("Mojo.class"));
         }
     }
 
     /**
-     * Test ModuleModule with a JAR file containing a .class file in the top
+     * Test ModuleFinder with a JAR file containing a .class file in the top
      * level directory.
      */
     public void testOfOneExplodedModuleWithTopLevelClass() throws Exception {
         Path dir = Files.createTempDirectory(USER_DIR, "mods");
         Path m_dir = createExplodedModule(dir.resolve("m"), "m", "Mojo.class");

@@ -409,18 +411,20 @@
         try {
             finder.find("m");
             assertTrue(false);
         } catch (FindException e) {
             assertTrue(e.getCause() instanceof InvalidModuleDescriptorException);
+            assertTrue(e.getCause().getMessage().contains("Mojo.class"));
         }
 
         finder = ModuleFinder.of(m_dir);
         try {
             finder.findAll();
             assertTrue(false);
         } catch (FindException e) {
             assertTrue(e.getCause() instanceof InvalidModuleDescriptorException);
+            assertTrue(e.getCause().getMessage().contains("Mojo.class"));
         }
     }
 
 
     /**
< prev index next >