< prev index next >

test/jdk/java/lang/ModuleTests/AnnotationsTest.java

Print this page

 34 import java.lang.module.Configuration;
 35 import java.lang.module.ModuleDescriptor;
 36 import java.lang.module.ModuleFinder;
 37 import java.net.URL;
 38 import java.net.URLClassLoader;
 39 import java.nio.file.Files;
 40 import java.nio.file.Path;
 41 import java.util.ArrayList;
 42 import java.util.List;
 43 import java.util.Set;
 44 
 45 import jdk.test.lib.util.ModuleInfoWriter;
 46 
 47 import org.testng.annotations.Test;
 48 import static org.testng.Assert.*;
 49 
 50 /**
 51  * @test
 52  * @modules java.base/jdk.internal.module
 53  * @library /test/lib
 54  * @build jdk.test.lib.util.ModuleInfoWriter
 55  * @run testng AnnotationsTest
 56  * @summary Basic test of annotations on modules
 57  */
 58 
 59 public class AnnotationsTest {
 60 
 61     /**
 62      * Test that there are no annotations on an unnamed module.
 63      */
 64     @Test
 65     public void testUnnamedModule() {
 66         Module module = this.getClass().getModule();
 67         assertTrue(module.getAnnotations().length == 0);
 68         assertTrue(module.getDeclaredAnnotations().length == 0);
 69     }
 70 
 71     /**
 72      * Test reflectively reading the annotations on a named module.
 73      */
 74     @Test

 34 import java.lang.module.Configuration;
 35 import java.lang.module.ModuleDescriptor;
 36 import java.lang.module.ModuleFinder;
 37 import java.net.URL;
 38 import java.net.URLClassLoader;
 39 import java.nio.file.Files;
 40 import java.nio.file.Path;
 41 import java.util.ArrayList;
 42 import java.util.List;
 43 import java.util.Set;
 44 
 45 import jdk.test.lib.util.ModuleInfoWriter;
 46 
 47 import org.testng.annotations.Test;
 48 import static org.testng.Assert.*;
 49 
 50 /**
 51  * @test
 52  * @modules java.base/jdk.internal.module
 53  * @library /test/lib

 54  * @run testng AnnotationsTest
 55  * @summary Basic test of annotations on modules
 56  */
 57 
 58 public class AnnotationsTest {
 59 
 60     /**
 61      * Test that there are no annotations on an unnamed module.
 62      */
 63     @Test
 64     public void testUnnamedModule() {
 65         Module module = this.getClass().getModule();
 66         assertTrue(module.getAnnotations().length == 0);
 67         assertTrue(module.getDeclaredAnnotations().length == 0);
 68     }
 69 
 70     /**
 71      * Test reflectively reading the annotations on a named module.
 72      */
 73     @Test
< prev index next >