Class JUnitAssertNotEqualsToAssertThat
- java.lang.Object
-
- org.openrewrite.Recipe
-
- org.openrewrite.java.testing.assertj.JUnitAssertNotEqualsToAssertThat
-
public class JUnitAssertNotEqualsToAssertThat extends org.openrewrite.RecipeThis is a refactoring visitor that will convert JUnit-style assertNotEquals() to assertJ's assertThat().isNotEqualTo().This visitor has to convert a surprisingly large number (93 methods) of JUnit's assertEquals to assertThat().
Two parameter variants:
assertNotEquals(expected,actual) == assertThat(actual).isNotEqualTo(expected)
Three parameter variant where the third argument is a String:
assertNotEquals(expected, actual, "message") == assertThat(actual).as("message").isNotEqualTo(expected)
Three parameter variant where the third argument is a String Supplier (there is no overloaded "as" method that takes a supplier):
assertNotEquals(expected, actual, "message") == assertThat(actual).withFailMessage("message").isNotEqualTo(expected)
Three parameter variant where args are all floating point numbers.
assertEquals(expected, actual, delta) == assertThat(actual).isCloseTo(expected, within(delta));
Four parameter variant when comparing floating point numbers with a delta and a message:
assertEquals(expected, actual, delta, "message") == assertThat(actual).withFailureMessage("message").isCloseTo(expected, within(delta));
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJUnitAssertNotEqualsToAssertThat.AssertNotEqualsToAssertThatVisitor
-
Constructor Summary
Constructors Constructor Description JUnitAssertNotEqualsToAssertThat()
-
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
-
-