17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.lang.module.ModuleDescriptor;
25 import java.lang.module.ModuleDescriptor.Exports;
26 import java.lang.reflect.Layer;
27 import java.lang.reflect.Module;
28 import java.util.function.Predicate;
29 import java.util.stream.Stream;
30
31 import org.testng.annotations.Test;
32 import static org.testng.Assert.*;
33
34 /*
35 * @test
36 * @summary Basic test of java.lang.reflect.Module
37 * @run testng BasicModuleTest
38 */
39
40 public class BasicModuleTest {
41
42 /**
43 * Tests that the given module reads all modules in the boot Layer.
44 */
45 private void testReadsAllBootModules(Module m) {
46 Layer bootLayer = Layer.boot();
47 bootLayer.configuration().get()
48 .descriptors()
49 .stream()
50 .map(ModuleDescriptor::name)
51 .map(bootLayer::findModule)
52 .forEach(target -> assertTrue(m.canRead(target.get())));
53 }
54
55 /**
56 * Returns {@code true} if the array contains the given object.
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.lang.module.ModuleDescriptor;
25 import java.lang.module.ModuleDescriptor.Exports;
26 import java.lang.reflect.Layer;
27 import java.lang.reflect.Module;
28 import java.util.function.Predicate;
29 import java.util.stream.Stream;
30
31 import org.testng.annotations.Test;
32 import static org.testng.Assert.*;
33
34 /*
35 * @test
36 * @summary Basic test of java.lang.reflect.Module
37 * @modules java.desktop java.xml
38 * @run testng BasicModuleTest
39 */
40
41 public class BasicModuleTest {
42
43 /**
44 * Tests that the given module reads all modules in the boot Layer.
45 */
46 private void testReadsAllBootModules(Module m) {
47 Layer bootLayer = Layer.boot();
48 bootLayer.configuration().get()
49 .descriptors()
50 .stream()
51 .map(ModuleDescriptor::name)
52 .map(bootLayer::findModule)
53 .forEach(target -> assertTrue(m.canRead(target.get())));
54 }
55
56 /**
57 * Returns {@code true} if the array contains the given object.
|