8159762: Some minor test bugs in java/lang/module/ModuleDescriptorTest.java
authormli
Sat, 18 Jun 2016 16:50:19 -0700
changeset 39064 45cbf2937973
parent 39063 500967b1216c
child 39065 3865e4792ddc
8159762: Some minor test bugs in java/lang/module/ModuleDescriptorTest.java Reviewed-by: alanb
jdk/test/java/lang/module/ModuleDescriptorTest.java
--- a/jdk/test/java/lang/module/ModuleDescriptorTest.java	Fri Jun 17 19:45:06 2016 -0700
+++ b/jdk/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()