Skip to content

Commit 652db21

Browse files
committed
Ensure Hamcrest imports are properly banned
1 parent 4c863f3 commit 652db21

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/checkstyle/checkstyle-suppressions.xml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,34 @@
6565
<suppress files="org[\\/]springframework[\\/]test[\\/]context[\\/]support[\\/]ContextLoaderUtilsContextHierarchyTests" checks="RegexpSinglelineJava" id="expectedExceptionAnnotation" />
6666
<suppress files="org[\\/]springframework[\\/]test[\\/]context[\\/]testng[\\/]transaction[\\/]programmatic/ProgrammaticTxMgmtTestNGTests" checks="RegexpSinglelineJava" id="expectedExceptionAnnotation" />
6767
<suppress files="org[\\/]springframework[\\/]test[\\/]context[\\/]transaction[\\/]programmatic[\\/]ProgrammaticTxMgmtTests" checks="RegexpSinglelineJava" id="expectedExceptionAnnotation" />
68-
<suppress files="JsonPathExpectationsHelper" checks="IllegalImport" id="bannedHamcrestImports" />
69-
<suppress files="XpathExpectationsHelper" checks="IllegalImport" id="bannedHamcrestImports" />
68+
<suppress files="org[\\/]springframework[\\/]test[\\/].+Tests" checks="IllegalImport" id="bannedHamcrestImports" />
69+
<suppress files="ContentRequestMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
70+
<suppress files="ContentResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
71+
<suppress files="CookieResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
7072
<suppress files="DefaultWebTestClient" checks="IllegalImport" id="bannedHamcrestImports" />
73+
<suppress files="FlashAttributeResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
74+
<suppress files="HandlerResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
7175
<suppress files="HeaderAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
72-
<suppress files="StatusAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
76+
<suppress files="HeaderResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
77+
<suppress files="JsonPathAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
78+
<suppress files="JsonPathExpectationsHelper" checks="IllegalImport" id="bannedHamcrestImports" />
79+
<suppress files="JsonPathRequestMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
7380
<suppress files="JsonPathResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
74-
<suppress files="src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]test[\\/]context[\\/]junit4" checks="SpringJUnit5"/>
75-
<suppress files="ContextHierarchyDirtiesContextTests|ClassLevelDirtiesContextTests|ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests|ContextConfigurationWithPropertiesExtendingPropertiesTests|DirtiesContextInterfaceTests|.*WacTests|JUnit4SpringContextWebTests" checks="SpringJUnit5"/>
81+
<suppress files="MockMvcResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
82+
<suppress files="MockRestRequestMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
83+
<suppress files="ModelResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
84+
<suppress files="RequestResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
85+
<suppress files="StatusAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
86+
<suppress files="StatusResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
87+
<suppress files="ViewResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
88+
<suppress files="WebTestClient" checks="IllegalImport" id="bannedHamcrestImports" />
89+
<suppress files="XmlExpectationsHelper" checks="IllegalImport" id="bannedHamcrestImports" />
90+
<suppress files="XpathAssertions" checks="IllegalImport" id="bannedHamcrestImports" />
91+
<suppress files="XpathExpectationsHelper" checks="IllegalImport" id="bannedHamcrestImports" />
92+
<suppress files="XpathRequestMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
93+
<suppress files="XpathResultMatchers" checks="IllegalImport" id="bannedHamcrestImports" />
94+
<suppress files="src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]test[\\/]context[\\/]junit4" checks="SpringJUnit5" />
95+
<suppress files="ContextHierarchyDirtiesContextTests|ClassLevelDirtiesContextTests|ContextConfigurationWithPropertiesExtendingPropertiesAndInheritedLoaderTests|ContextConfigurationWithPropertiesExtendingPropertiesTests|DirtiesContextInterfaceTests|.*WacTests|JUnit4SpringContextWebTests" checks="SpringJUnit5" />
7696

7797
<!-- spring-web -->
7898
<suppress files="SpringHandlerInstantiator" checks="JavadocStyle" />

src/checkstyle/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<property name="id" value="bannedHamcrestImports"/>
107107
<property name="regexp" value="true" />
108108
<property name="illegalClasses"
109-
value="^org\.hamcrest\.MatcherAssert" />
109+
value="^org\.hamcrest\..+" />
110110
</module>
111111

112112
<!-- Javadoc Comments -->

0 commit comments

Comments
 (0)