Skip to content

Commit

Permalink
feat: Add recipes for negative variants of startsWith, endsWith, and …
Browse files Browse the repository at this point in the history
…matches (#594)
  • Loading branch information
Tahanima authored Sep 7, 2024
1 parent 541e480 commit 5c23f07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/resources/META-INF/rewrite/assertj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,31 @@ recipeList:
assertToReplace: isTrue
dedicatedAssertion: startsWith
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: startsWith
assertToReplace: isFalse
dedicatedAssertion: doesNotStartWith
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: endsWith
assertToReplace: isTrue
dedicatedAssertion: endsWith
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: endsWith
assertToReplace: isFalse
dedicatedAssertion: doesNotEndWith
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: matches
assertToReplace: isTrue
dedicatedAssertion: matches
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: matches
assertToReplace: isFalse
dedicatedAssertion: doesNotMatch
requiredType: java.lang.String
- org.openrewrite.java.testing.assertj.SimplifyChainedAssertJAssertion:
chainedAssertion: trim
assertToReplace: isEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ private static Stream<Arguments> stringReplacements() {
Arguments.arguments("equalsIgnoreCase", "isTrue", "isEqualToIgnoringCase", "expected", ""),
Arguments.arguments("contains", "isTrue", "contains", "expected", ""),
Arguments.arguments("startsWith", "isTrue", "startsWith", "expected", ""),
Arguments.arguments("startsWith", "isFalse", "doesNotStartWith", "expected", ""),
Arguments.arguments("endsWith", "isTrue", "endsWith", "expected", ""),
Arguments.arguments("endsWith", "isFalse", "doesNotEndWith", "expected", ""),
Arguments.arguments("matches", "isTrue", "matches", "expected", ""),
Arguments.arguments("matches", "isFalse", "doesNotMatch", "expected", ""),
Arguments.arguments("trim", "isEmpty", "isBlank", "", ""),
Arguments.arguments("length", "isEqualTo", "hasSize", "", "length"),
Arguments.arguments("isEmpty", "isFalse", "isNotEmpty", "", "")
Expand Down

0 comments on commit 5c23f07

Please sign in to comment.