Skip to content

Commit

Permalink
Adds more module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Jan 19, 2025
1 parent 9bd9bc0 commit 46ca5ba
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ void classCanBeVerified() {
EqualsVerifier.forClass(ClassPoint.class).verify();
}

@Test
void classContainingClassCanBeVerifier() {
EqualsVerifier.forClass(ClassPointContainer.class).verify();
}

@Test
@Disabled("It's impossble to load `equalsverifier-16` in the module world "
+ "because it creates a split path. We can enable this test again "
Expand All @@ -21,6 +26,14 @@ void recordCanBeVerified() {
EqualsVerifier.forClass(RecordPoint.class).verify();
}

@Test
@Disabled("It's impossble to load `equalsverifier-16` in the module world "
+ "because it creates a split path. We can enable this test again "
+ "when EqualsVerifier's baseline becomes Java 17")
void recordContainingRecordCanBeVerified() {
EqualsVerifier.forClass(RecordPointContainer.class).verify();
}

@Test
void classContainingFieldsFromOtherJdkModulesCanBeVerifier() {
EqualsVerifier.forClass(FieldsFromJdkModulesHaver.class).verify();
Expand Down Expand Up @@ -51,8 +64,28 @@ public int hashCode() {
}
}

static final class ClassPointContainer {
private final ClassPoint cp;

private ClassPointContainer(ClassPoint cp) {
this.cp = cp;
}

@Override
public boolean equals(Object obj) {
return obj instanceof ClassPointContainer other && Objects.equals(cp, other.cp);
}

@Override
public int hashCode() {
return Objects.hash(cp);
}
}

record RecordPoint(int x, int y) {}

record RecordPointContainer(RecordPoint rp) {}

static final class FieldsFromJdkModulesHaver {
private final java.awt.Color desktopAwtColor;
private final java.rmi.server.UID rmiUid;
Expand Down

0 comments on commit 46ca5ba

Please sign in to comment.