-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
Description
What problem are you trying to solve?
Resolve Sonar issues of type java:S5838
What precondition(s) should be checked before applying this recipe?
AssertJ library is present
Describe the situation before applying the recipe
class A {
void foo(Iterable bar) {
assertThat(bar).hasSize(0);
}
}
Describe the situation after applying the recipe
class A {
void foo(Iterable bar) {
assertThat(bar).isEmpty();
}
}
Have you considered any alternatives or workarounds?
Any additional context
There might be other situations for AbstractIterableAssert
or ListAssert
that could be changed, too.
The issue can be reproduced by adding to org.openrewrite.java.testing.assertj.AssertJBestPracticesTest.SonarDedicatedAssertions#replacements
:
arguments("java.lang.Iterable", "assertThat(x).hasSize(0)", "assertThat(x).isEmpty()"),
Are you interested in contributing this recipe to OpenRewrite?
In general, yes, but too busy ATM.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress