Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Additional test to enforce documentation comment conventions #1450

Merged
merged 10 commits into from
May 31, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,35 @@ public void testThatAllValidationNoticesAreDocumented() {
.isEmpty();
}

@Test
public void testThatAllValidationNoticesAreDocumentedWithFirstLine() {
List<Class<?>> noticesWithImproperMultilineDocComment =
discoverValidationNoticeClasses()
.filter(
clazz -> {
NoticeDocComments docComments = NoticeSchemaGenerator.loadComments(clazz);
if (docComments.getShortSummary() == null) {
return false;
}
return docComments.getShortSummary().contains(". ");
})
.collect(Collectors.toList());
assertWithMessage(
"We expect all validation notices to have a documentation comment of the "
+ "following form:\n"
+ "\n"
+ " Short single-sentence text describing the notice on a single line (required).\n"
+ " \n"
+ " Additional text further describing the notice with multiple additional sentences "
+ "on multiple lines(optional).\n"
+ "\n"
+ "See https://github.com/MobilityData/gtfs-validator/blob/master/docs/NEW_RULES.md#2-document-the-new-rule for more details.<br/>\n"
+ "\n"
+ "The following notice classes do not match that convention:")
.that(noticesWithImproperMultilineDocComment)
.isEmpty();
}

@Test
public void testThatValidationNoticesDoNotUseUnsupportedJavadocSyntax() {
List<String> noticesWithInvalidJavadoc =
Expand Down