changeset 14859:7ff61c55b5c6 jdk-9+124

8159762: Some minor test bugs in java/lang/module/ModuleDescriptorTest.java Reviewed-by: alanb
author mli
date Sat, 18 Jun 2016 16:50:19 -0700
parents 0c3d00b560c9
children 59c4daf11af4 898d547c40ef d737b8d0c9c9 b64fdc808532
files test/java/lang/module/ModuleDescriptorTest.java
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/module/ModuleDescriptorTest.java	Fri Jun 17 19:45:06 2016 -0700
+++ b/test/java/lang/module/ModuleDescriptorTest.java	Sat Jun 18 16:50:19 2016 -0700
@@ -135,8 +135,8 @@
 
     @Test(expectedExceptions = IllegalArgumentException.class)
     public void testRequiresSelfWithRequires() {
-        Requires r = requires(null, "m");
-        new Builder("m").requires(r);
+        Requires r = requires(null, "foo");
+        new Builder("foo").requires(r);
     }
 
     @Test(expectedExceptions = IllegalArgumentException.class)
@@ -173,6 +173,21 @@
         assertTrue(r2.compareTo(r1) == -n);
     }
 
+    public void testRequiresCompareWithDifferentModifiers() {
+        Requires r1 = requires(EnumSet.of(PUBLIC), "foo");
+        Requires r2 = requires(EnumSet.of(SYNTHETIC), "foo");
+        int n = Integer.compare(1 << PUBLIC.ordinal(), 1 << SYNTHETIC.ordinal());
+        assertTrue(r1.compareTo(r2) == n);
+        assertTrue(r2.compareTo(r1) == -n);
+    }
+
+    public void testRequiresCompareWithSameModifiers() {
+        Requires r1 = requires(EnumSet.of(SYNTHETIC), "foo");
+        Requires r2 = requires(EnumSet.of(SYNTHETIC), "foo");
+        assertTrue(r1.compareTo(r2) == 0);
+        assertTrue(r2.compareTo(r1) == 0);
+    }
+
     public void testRequiresToString() {
         Requires r = requires(EnumSet.noneOf(Modifier.class), "foo");
         assertTrue(r.toString().contains("foo"));
@@ -332,7 +347,7 @@
 
     private Provides provides(String st, String pc) {
         return new Builder("foo")
-            .provides("p.S", pc)
+            .provides(st, pc)
             .build()
             .provides()
             .values()