Migrate to AssertJ assertions
org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ
Migrate Hamcrest assertThat(..)
to AssertJ Assertions
.
Tags
testing
assertj
hamcrest
Recipe source
GitHub, Issue Tracker, Maven Central
groupId: org.openrewrite.recipe
artifactId: rewrite-testing-frameworks
version: 2.7.0
This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.
Usage
This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-testing-frameworks:2.7.0
in your build file or by running a shell command (in which case no build changes are needed):
Add the following to your
build.gradle
file:
Run
gradle rewriteRun
to run the recipe.
Definition
Change method target to static
methodPattern:
org.hamcrest.core.Is is(..)
fullyQualifiedTargetTypeName:
org.hamcrest.Matchers
Migrate from Hamcrest
Matcher
to AssertJmatcher:
comparesEqualTo
assertion:
isEqualTo
argumentType:
java.lang.String
Migrate from Hamcrest
Matcher
to AssertJmatcher:
comparesEqualTo
assertion:
isEqualByComparingTo
Migrate from Hamcrest
Matcher
to AssertJmatcher:
equalTo
assertion:
isEqualTo
Migrate from Hamcrest
Matcher
to AssertJmatcher:
greaterThanOrEqualTo
assertion:
isGreaterThanOrEqualTo
Migrate from Hamcrest
Matcher
to AssertJmatcher:
greaterThan
assertion:
isGreaterThan
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasToString
assertion:
hasToString
Migrate from Hamcrest
Matcher
to AssertJmatcher:
lessThanOrEqualTo
assertion:
isLessThanOrEqualTo
Migrate from Hamcrest
Matcher
to AssertJmatcher:
lessThan
assertion:
isLessThan
Migrate from Hamcrest
Matcher
to AssertJmatcher:
notNullValue
assertion:
isNotNull
Migrate from Hamcrest
Matcher
to AssertJmatcher:
not
assertion:
isNotEqualTo
Migrate from Hamcrest
Matcher
to AssertJmatcher:
nullValue
assertion:
isNull
Migrate from Hamcrest
Matcher
to AssertJmatcher:
sameInstance
assertion:
isSameAs
Migrate from Hamcrest
Matcher
to AssertJmatcher:
instanceOf
assertion:
isInstanceOf
Migrate from Hamcrest
Matcher
to AssertJmatcher:
isA
assertion:
isInstanceOf
Migrate from Hamcrest
Matcher
to AssertJmatcher:
arrayContaining
assertion:
containsExactly
Migrate from Hamcrest
Matcher
to AssertJmatcher:
arrayContainingInAnyOrder
assertion:
containsExactlyInAnyOrder
Migrate from Hamcrest
Matcher
to AssertJmatcher:
arrayWithSize
assertion:
hasSize
Migrate from Hamcrest
Matcher
to AssertJmatcher:
emptyArray
assertion:
isEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasItemInArray
assertion:
contains
Migrate from Hamcrest
Matcher
to AssertJmatcher:
blankString
assertion:
isBlank
Migrate from Hamcrest
Matcher
to AssertJmatcher:
containsString
assertion:
contains
Migrate from Hamcrest
Matcher
to AssertJmatcher:
containsStringIgnoringCase
assertion:
containsIgnoringCase
Migrate from Hamcrest
Matcher
to AssertJmatcher:
emptyOrNullString
assertion:
isNullOrEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
emptyString
assertion:
isEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
endsWith
assertion:
endsWith
Migrate from Hamcrest
Matcher
to AssertJmatcher:
endsWithIgnoringCase
assertion:
endsWithIgnoringCase
Migrate from Hamcrest
Matcher
to AssertJmatcher:
equalToIgnoringCase
assertion:
isEqualToIgnoringCase
Migrate from Hamcrest
Matcher
to AssertJmatcher:
equalToIgnoringWhiteSpace
assertion:
isEqualToIgnoringWhitespace
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasLength
assertion:
hasSize
Migrate from Hamcrest
Matcher
to AssertJmatcher:
isEmptyString
assertion:
isEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
isEmptyOrNullString
assertion:
isNullOrEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
matchesPattern
assertion:
matches
Migrate from Hamcrest
Matcher
to AssertJmatcher:
matchesRegex
assertion:
matches
Migrate from Hamcrest
Matcher
to AssertJmatcher:
startsWith
assertion:
startsWith
Migrate from Hamcrest
Matcher
to AssertJmatcher:
startsWithIgnoringCase
assertion:
startsWithIgnoringCase
Migrate from Hamcrest
Matcher
to AssertJmatcher:
contains
assertion:
containsExactly
Migrate from Hamcrest
Matcher
to AssertJmatcher:
containsInAnyOrder
assertion:
containsExactlyInAnyOrder
Migrate from Hamcrest
Matcher
to AssertJmatcher:
empty
assertion:
isEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasSize
assertion:
hasSize
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasItem
assertion:
contains
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasItems
assertion:
contains
Migrate from Hamcrest
Matcher
to AssertJmatcher:
in
assertion:
isIn
Migrate from Hamcrest
Matcher
to AssertJmatcher:
isIn
assertion:
isIn
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasEntry
assertion:
containsEntry
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasKey
assertion:
containsKey
Migrate from Hamcrest
Matcher
to AssertJmatcher:
hasValue
assertion:
containsValue
Migrate from Hamcrest
Matcher
to AssertJmatcher:
aMapWithSize
assertion:
hasSize
Migrate from Hamcrest
Matcher
to AssertJmatcher:
anEmptyMap
assertion:
isEmpty
Migrate from Hamcrest
Matcher
to AssertJmatcher:
closeTo
assertion:
isCloseTo
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
equalTo
assertion:
isNotEqualTo
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
hasToString
assertion:
doesNotHaveToString
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
in
assertion:
isNotIn
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
isIn
assertion:
isNotIn
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
instanceOf
assertion:
isNotInstanceOf
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
nullValue
assertion:
isNotNull
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
sameInstance
assertion:
isNotSameAs
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
equalToIgnoringCase
assertion:
isNotEqualToIgnoringCase
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
equalToIgnoringWhiteSpace
assertion:
isNotEqualToIgnoringWhitespace
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
containsString
assertion:
doesNotContain
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
containsStringIgnoringCase
assertion:
doesNotContainIgnoringCase
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
startsWith
assertion:
doesNotStartWith
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
endsWith
assertion:
doesNotEndWith
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
matchesPattern
assertion:
doesNotMatch
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
matchesRegex
assertion:
doesNotMatch
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
blankString
assertion:
isNotBlank
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
emptyString
assertion:
isNotEmpty
Migrate Hamcrest
not(Matcher)
to AssertJnotMatcher:
hasItem
assertion:
doesNotContain
Add Gradle or Maven dependency
groupId:
org.assertj
artifactId:
assertj-core
version:
3.x
onlyIfUsing:
org.assertj.core.api.Assertions
acceptTransitive:
true
See how this recipe works across multiple open-source repositories
The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.
Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.
Contributors
Last updated