Skip to content

Commit c1be564

Browse files
committed
1 parent cfff22c commit c1be564

97 files changed

Lines changed: 142 additions & 104 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/test/java/org/htmlunit/CodeStyleTest.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ private void process(final List<File> files, final List<String> classNames) thro
170170
classNameUsed(lines, classNames, relativePath);
171171
spaces(lines, relativePath);
172172
indentation(lines, relativePath);
173+
if (!"package-info.java".equals(file.getName())) {
174+
authorTagAtLeastOne(lines, relativePath);
175+
authorTagNoDuplicates(lines, relativePath);
176+
authorTagRonaldBrill(lines, relativePath);
177+
}
173178
}
174179
}
175180
}
@@ -826,6 +831,48 @@ private void alertVerifyOrder(final String browserName, final List<String> previ
826831
}
827832
}
828833

834+
/**
835+
* Checks that the file contains at least one {@code @author} tag.
836+
*/
837+
private void authorTagAtLeastOne(final List<String> lines, final String path) {
838+
final boolean hasAuthor = lines.stream()
839+
.anyMatch(line -> line.trim().startsWith("* @author"));
840+
if (!hasAuthor) {
841+
addFailure(path, 0, "Missing @author tag");
842+
}
843+
}
844+
845+
/**
846+
* Checks that the file contains no duplicate {@code @author} tags
847+
* (same author name listed more than once).
848+
*/
849+
private void authorTagNoDuplicates(final List<String> lines, final String path) {
850+
final List<String> authors = new ArrayList<>();
851+
for (int i = 0; i < lines.size(); i++) {
852+
final String trimmed = lines.get(i).trim();
853+
if (trimmed.startsWith("* @author")) {
854+
final String author = trimmed.substring("* @author".length()).trim();
855+
if (authors.contains(author)) {
856+
addFailure(path, i + 1, "Duplicate @author tag: " + author);
857+
}
858+
else {
859+
authors.add(author);
860+
}
861+
}
862+
}
863+
}
864+
865+
/**
866+
* Checks that the file contains an {@code @author Ronald Brill} tag.
867+
*/
868+
private void authorTagRonaldBrill(final List<String> lines, final String path) {
869+
final boolean hasRonaldBrill = lines.stream()
870+
.anyMatch(line -> line.trim().equals("* @author Ronald Brill"));
871+
if (!hasRonaldBrill) {
872+
addFailure(path, 0, "Missing @author Ronald Brill tag");
873+
}
874+
}
875+
829876
/**
830877
* Verifies that no extra leading spaces (in test code).
831878
*/

src/test/java/org/htmlunit/DefaultCredentialsProvider3Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Tests for {@link DefaultCredentialsProvider}.
2626
*
2727
* @author Marc Guillemot
28+
* @author Ronald Brill
2829
*/
2930
public class DefaultCredentialsProvider3Test {
3031

src/test/java/org/htmlunit/NicelyResynchronizingAjaxControllerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Tests for {@link NicelyResynchronizingAjaxController}.
2121
*
2222
* @author Nick Kralevich
23+
* @author Ronald Brill
2324
*/
2425
public class NicelyResynchronizingAjaxControllerTest extends WebServerTestCase {
2526

src/test/java/org/htmlunit/ObjectInstantiationExceptionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Tests for {@link ObjectInstantiationException}.
2727
*
2828
* @author Ahmed Ashour
29+
* @author Ronald Brill
2930
*/
3031
public class ObjectInstantiationExceptionTest {
3132

src/test/java/org/htmlunit/ScriptExceptionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*
2929
* @author Marc Guillemot
3030
* @author Ahmed Ashour
31+
* @author Ronald Brill
3132
*/
3233
public final class ScriptExceptionTest extends SimpleWebTestCase {
3334

src/test/java/org/htmlunit/ScriptPreProcessorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* @author Ahmed Ashour
3737
* @author Daniel Gredler
3838
* @author Sudhan Moghe
39+
* @author Ronald Brill
3940
*/
4041
public class ScriptPreProcessorTest extends WebServerTestCase {
4142

src/test/java/org/htmlunit/SgmlPage2Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Tests for {@link SgmlPage}.
2525
*
2626
* @author Ahmed Ashour
27+
* @author Ronald Brill
2728
*/
2829
public final class SgmlPage2Test extends WebDriverTestCase {
2930

src/test/java/org/htmlunit/SgmlPageTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* Tests for {@link SgmlPage}.
3838
*
3939
* @author Ahmed Ashour
40+
* @author Ronald Brill
4041
*/
4142
public final class SgmlPageTest extends WebServerTestCase {
4243

src/test/java/org/htmlunit/WaitingRefreshHandlerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Tests for {@link WaitingRefreshHandlerTest}.
2222
*
2323
* @author Brad Clarke
24+
* @author Ronald Brill
2425
*/
2526
public final class WaitingRefreshHandlerTest extends SimpleWebTestCase {
2627

src/test/java/org/htmlunit/WebResponse2Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*
3232
* @author Marc Guillemot
3333
* @author Ahmed Ashour
34+
* @author Ronald Brill
3435
*/
3536
public class WebResponse2Test extends SimpleWebTestCase {
3637

0 commit comments

Comments
 (0)