Add SpringJUnit5 checkstyle rule
Add `SpringJUnit5` checkstyle rule to ensure that JUnit 4 annotations aren't accidentally used in new tests. The "must not be public" rule has been suppressed since there are quite a few tests that extend base tests from other packages.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
<!-- global -->
|
||||
<suppress files="[\\/]src[\\/]test[\\/]java[\\/]" checks="AnnotationLocation|AnnotationUseStyle|AtclauseOrder|AvoidNestedBlocks|FinalClass|HideUtilityClassConstructor|InnerTypeLast|JavadocStyle|JavadocType|JavadocVariable|LeftCurly|MultipleVariableDeclarations|NeedBraces|OneTopLevelClass|OuterTypeFilename|RequireThis|SpringCatch|SpringJavadoc|SpringNoThis" />
|
||||
<suppress files="[\\/]src[\\/]test[\\/]java[\\/]" checks="SpringJUnit5" message="should not be public" />
|
||||
|
||||
<!-- spring-beans -->
|
||||
<suppress files="TypeMismatchException" checks="MutableException"/>
|
||||
@@ -70,6 +71,8 @@
|
||||
<suppress files="HeaderAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
|
||||
<suppress files="StatusAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
|
||||
<suppress files="JsonPathResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
|
||||
<suppress files="src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]test[\\/]context[\\/]junit4" checks="SpringJUnit5"/>
|
||||
<suppress files="ContextHierarchyDirtiesContextTests|ClassLevelDirtiesContextTests|ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests|ContextConfigurationWithPropertiesExtendingPropertiesTests|DirtiesContextInterfaceTests|.*WacTests|JUnit4SpringContextWebTests" checks="SpringJUnit5"/>
|
||||
|
||||
<!-- spring-web -->
|
||||
<suppress files="SpringHandlerInstantiator" checks="JavadocStyle" />
|
||||
|
||||
@@ -211,5 +211,6 @@
|
||||
</module>
|
||||
<module name="io.spring.javaformat.checkstyle.check.SpringCatchCheck" />
|
||||
<module name="io.spring.javaformat.checkstyle.check.SpringJavadocCheck" />
|
||||
<module name="io.spring.javaformat.checkstyle.check.SpringJUnit5Check" />
|
||||
</module>
|
||||
</module>
|
||||
|
||||
Reference in New Issue
Block a user