Class JUnitAssertSameToAssertThat


  • public class JUnitAssertSameToAssertThat
    extends org.openrewrite.Recipe
    This is a refactoring visitor that will convert JUnit-style assertSame() to assertJ's assertThat().isSameAs().

    This visitor only supports the migration of the following JUnit 5 assertSame() methods:

     assertSame(Object expected, Object actual) == assertThat(actual).isSameAs(expected)
     assertSame(Object expected, Object actual, String message) == assertThat(actual).as(message).isSameAs(expected)
     assertSame(Object expected, Object actual, Supplier messageSupplier) == assertThat(actual).withFailMessage(messageSupplier).isSameAs(expected);
     
    • Field Summary

      • Fields inherited from class org.openrewrite.Recipe

        NOOP
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()  
      java.lang.String getDisplayName()  
      protected org.openrewrite.TreeVisitor<?,​org.openrewrite.ExecutionContext> getVisitor()  
      • Methods inherited from class org.openrewrite.Recipe

        causesAnotherCycle, doNext, equals, getApplicableTest, getDescriptor, getJacksonPolymorphicTypeTag, getLanguages, getName, getRecipeList, getTags, hashCode, run, run, run, run, validate, validate, validateAll, validateAll, visit
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JUnitAssertSameToAssertThat

        public JUnitAssertSameToAssertThat()
    • Method Detail

      • getDisplayName

        public java.lang.String getDisplayName()
        Specified by:
        getDisplayName in class org.openrewrite.Recipe
      • getDescription

        public java.lang.String getDescription()
        Overrides:
        getDescription in class org.openrewrite.Recipe
      • getVisitor

        protected org.openrewrite.TreeVisitor<?,​org.openrewrite.ExecutionContext> getVisitor()
        Overrides:
        getVisitor in class org.openrewrite.Recipe