Class JUnitFailToAssertJFail


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

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

     fail()                                  ==   fail("")
     fail(String message)                    ==   fail(String message)
     fail(String message, Throwable cause)   ==   fail(String message, Throwable cause)
     fail(Throwable cause)                   ==   fail("", Throwable cause)
     

    Note: There is an additional method signature in JUnit that accepts a StringSupplier as an argument. Attempts to map this signature into assertJ's model obfuscates the original assertion.

    • 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

        doNext, equals, 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

      • JUnitFailToAssertJFail

        public JUnitFailToAssertJFail()
    • 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