8159762: Some minor test bugs in java/lang/module/ModuleDescriptorTest.java
Reviewed-by: alanb
This commit is contained in:
parent
744c257015
commit
2ac6a74d79
@ -135,8 +135,8 @@ public class ModuleDescriptorTest {
|
||||
|
||||
@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 @@ public class ModuleDescriptorTest {
|
||||
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 @@ public class ModuleDescriptorTest {
|
||||
|
||||
private Provides provides(String st, String pc) {
|
||||
return new Builder("foo")
|
||||
.provides("p.S", pc)
|
||||
.provides(st, pc)
|
||||
.build()
|
||||
.provides()
|
||||
.values()
|
||||
|
Loading…
Reference in New Issue
Block a user