提交 f8a93ee4 编写于 作者: P Phillip Webb

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.
上级 0db2f8fb
......@@ -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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册