Skip to content

Commit

Permalink
Tests that javadoc jars don't contain non-exported classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jqno committed Jan 19, 2025
1 parent 930e96b commit 9bd9bc0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ static void clean() throws Exception {
}

@Test
void presenceOfCoreSources() {
void presenceOfCoreFiles() {
jar.assertPresenceOf("/index.html", "/nl.jqno.equalsverifier" + EV + "/EqualsVerifier.html");
}

@Test
void absenceOfNonExportedPackages() {
jar.assertAbsenceOf("/nl.jqno.equalsverifier" + EV + "/internal");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ static void clean() throws Exception {
}

@Test
void presenceOfCoreSources() {
void presenceOfCoreFiles() {
jar.assertPresenceOf("/index.html", "/nl.jqno.equalsverifier" + EV + "/EqualsVerifier.html");
}

@Test
void absenceOfNonExportedPackages() {
jar.assertAbsenceOf("/nl.jqno.equalsverifier" + EV + "/internal");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Set;

public class JarAsserter {

public static final String EV = "/nl/jqno/equalsverifier";
Expand Down Expand Up @@ -47,6 +49,12 @@ public void assertAbsenceOf(String... fileNames) {
assertThat(fileNames).allMatch(fn -> !entries.contains(fn), "absent from " + reader.getFilename());
}

public void assertAbsenceOfDirectory(String... dirNames) {
var dirs = Set.of(dirNames);
var entries = reader.getEntries();
assertThat(entries).noneMatch(dirs::contains);
}

public void assertContentOfManifest(String implementationTitle) {
var filename = "/META-INF/MANIFEST.MF";
var manifest = new String(reader.getContentOf(filename));
Expand Down

0 comments on commit 9bd9bc0

Please sign in to comment.