Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipes for negative variants of startsWith, endsWith, and matches #594

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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