Would you please review the following patch for some minor test bug?

bug: https://bugs.openjdk.java.net/browse/JDK-8159762
webrev: http://cr.openjdk.java.net/~mli/8159762/webrev.00/

Thank you
-Hamlin

------------------------------------------------------------------------

below comments in diff is only for review convenience, they're not in the code.

--- a/test/java/lang/module/ModuleDescriptorTest.java Wed Jun 15 23:24:08 2016 +0000 +++ b/test/java/lang/module/ModuleDescriptorTest.java Thu Jun 16 19:58:30 2016 -0700
@@ -133,8 +133,8 @@

     @Test(expectedExceptions = IllegalArgumentException.class)
     public void testRequiresSelfWithRequires() {
- Requires r = requires(null, "m");
- new Builder("m").requires(r); *// this line is never touched, because above line throws exception first, so intended test scenario is never run.***
+ Requires r = requires(null, "foo");
+ new Builder("foo").requires(r);
     }

     @Test(expectedExceptions = IllegalArgumentException.class)
@@ -171,6 +171,14 @@
         assertTrue(r2.compareTo(r1) == -n);
     }

+ public void testRequiresCompareWithDifferentModifier() {*// add new test scenario: same requires with different Modifier.***
+ 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 testRequiresToString() {
         Requires r = requires(EnumSet.noneOf(Modifier.class), "foo");
         assertTrue(r.toString().contains("foo"));
@@ -330,7 +338,7 @@

     private Provides provides(String st, String pc) {
         return new Builder("foo")
- .provides("p.S", pc)*// parameter st is never used.***
+ .provides(st, pc)
             .build()
             .provides()
             .values()

Reply via email to