Class JUnitAssertArrayEqualsToAssertThat
- java.lang.Object
-
- org.openrewrite.Recipe
-
- org.openrewrite.java.testing.assertj.JUnitAssertArrayEqualsToAssertThat
-
public class JUnitAssertArrayEqualsToAssertThat extends org.openrewrite.RecipeThis is a refactoring visitor that will convert JUnit-style assertArrayEquals() to assertJ's assertThat().containsExactly().This visitor will handle the following JUnit 5 method signatures:
Two parameter variants:
assertArrayEquals(expected,actual) == assertThat(actual).containsExactly(expected)
Three parameter variant where the third argument is a String:
assertArrayEquals(expected, actual, "message") == assertThat(actual).as("message").containsExactly(expected)
Three parameter variant where the third argument is a String supplier:
assertArrayEquals(expected, actual, () == "message") == assertThat(actual).withFailureMessage("message").containsExactly(expected)
Three parameter variant where args are all floating point numbers.
assertArrayEquals(expected, actual, delta) == assertThat(actual).containsExactly(expected, within(delta));
Four parameter variant when comparing floating point numbers with a delta and a message:
assertArrayEquals(expected, actual, delta, "message") == assertThat(actual).withFailureMessage("message").containsExactly(expected, within(delta));
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJUnitAssertArrayEqualsToAssertThat.AssertArrayEqualsToAssertThatVisitor
-
Constructor Summary
Constructors Constructor Description JUnitAssertArrayEqualsToAssertThat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()java.lang.StringgetDisplayName()protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>getVisitor()
-
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
public java.lang.String getDescription()
- Overrides:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
- Overrides:
getVisitorin classorg.openrewrite.Recipe
-
-