Skip to content

Commit 5bf8029

Browse files
fix: assertj contains is weaker than hamcrests, containsExactly matches hamcrests contains (#371)
1 parent 266c018 commit 5bf8029

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/resources/META-INF/rewrite/hamcrest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ recipeList:
140140
# List Matchers
141141
- org.openrewrite.java.testing.hamcrest.HamcrestMatcherToAssertJ:
142142
matcher: contains
143-
assertion: contains
143+
assertion: containsExactly
144144
- org.openrewrite.java.testing.hamcrest.HamcrestMatcherToAssertJ:
145145
matcher: containsInAnyOrder
146146
assertion: containsExactlyInAnyOrder

src/test/java/org/openrewrite/java/testing/hamcrest/MigrateHamcrestToAssertJTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void test() {
229229

230230
private static Stream<Arguments> listReplacements() {
231231
return Stream.of(
232-
Arguments.arguments("list1", "contains", "item", "contains"),
232+
Arguments.arguments("list1", "contains", "item", "containsExactly"),
233233
Arguments.arguments("list1", "containsInAnyOrder", "item", "containsExactlyInAnyOrder"),
234234
Arguments.arguments("list1", "containsInRelativeOrder", "item", "containsExactly"),
235235
Arguments.arguments("list1", "empty", "", "isEmpty"),

0 commit comments

Comments
 (0)