Skip to content

Commit

Permalink
Merge pull request #7878 from murdos/checkstyle-rule-junit4
Browse files Browse the repository at this point in the history
Checkstyle rule to prevent usage of junit4
  • Loading branch information
pascalgrimaud authored Oct 28, 2023
2 parents 9695949 + 175939c commit 30da8f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
<module name="TreeWalker">
<module name="RedundantImport" />
<module name="UnusedImports" />
<module name="IllegalImport">
<property name="regexp" value="true" />
<!-- Reject any org.junit import that's not also org.junit.jupiter: -->
<property name="illegalClasses" value="^org\.junit\.(?!jupiter\.)(?!platform\.).+" />
</module>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
<module name="TreeWalker">
<module name="RedundantImport" />
<module name="UnusedImports" />
<module name="IllegalImport">
<property name="regexp" value="true"/>
<!-- Reject any org.junit import that's not also org.junit.jupiter: -->
<property name="illegalClasses" value="^org\.junit\.(?!jupiter\.)(?!platform\.).+"/>
</module>
</module>
</module>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tech.jhipster.lite.generator.server.javatool.checkstyle.domain;

import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.*;
import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.assertThatModuleWithFiles;
import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.pomFile;

import org.junit.jupiter.api.Test;
import tech.jhipster.lite.TestFileUtils;
Expand Down Expand Up @@ -49,6 +50,7 @@ void shouldBuildModule() {
)
.and()
.hasFile("checkstyle.xml")
.containing("<module name=\"IllegalImport\">")
.containing("<module name=\"Checker\">")
.containing("<module name=\"TreeWalker\">")
.containing("<module name=\"UnusedImports\" />");
Expand Down

0 comments on commit 30da8f0

Please sign in to comment.