Migrate TestNG assertions to AssertJ

Migrate all existing TestNG based assertions to AssertJ and add
Checkstyle rules to ensure they don't return.

See gh-23022
This commit is contained in:
Sam Brannen
2019-05-26 18:19:56 +02:00
parent 50cc23ca55
commit 4f4427f550
10 changed files with 87 additions and 74 deletions

View File

@@ -98,7 +98,7 @@
<property name="id" value="bannedImports"/>
<property name="regexp" value="true" />
<property name="illegalClasses"
value="^reactor\.core\.support\.Assert,^junit\.framework\..+,^org\.junit\.Assert$,^org\.junit\.Assume$,^org\.junit\.jupiter\.api\.Assertions$,^org\.junit\.Assert\.assertThat,^org\.junit\.Assume\.assumeThat,^org\.junit\.rules\.ExpectedException,^org\.slf4j\.LoggerFactory" />
value="^reactor\.core\.support\.Assert,^junit\.framework\..+,^org\.junit\.Assert$,^org\.junit\.Assume$,^org\.junit\.jupiter\.api\.Assertions$,^org\.junit\.Assert\.assertThat,^org\.junit\.Assume\.assumeThat,^org\.testng\.Assert$,^org\.testng\.AssertJUnit$,^org\.junit\.rules\.ExpectedException,^org\.slf4j\.LoggerFactory" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
<property name="id" value="bannedHamcrestImports"/>
@@ -194,6 +194,14 @@
<property name="message" value="Please use AssertJ assertions." />
<property name="ignoreComments" value="true" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck">
<property name="id" value="testNGAssertions"/>
<property name="maximum" value="0"/>
<!-- should cover org.testng.Assert and org.testng.AssertJUnit -->
<property name="format" value="org\.testng\.Assert(JUnit)?\.assert" />
<property name="message" value="Please use AssertJ assertions." />
<property name="ignoreComments" value="true" />
</module>
<!-- Spring Conventions -->
<module name="io.spring.javaformat.checkstyle.check.SpringLambdaCheck">