Class UpdateMockWebServer


  • public class UpdateMockWebServer
    extends org.openrewrite.Recipe
    Recipe for converting JUnit4 okhttp3 MockWebServer Rules with their JUnit5 equivalent. Note this recipe upgrades okhttp3 to version 4.x there are a few backwards incompatible changes: https://square.github.io/okhttp/upgrading_to_okhttp_4/#backwards-incompatible-changes - If MockWebServer Rule exists remove the Rule annotation and update okhttp3 to version 4.x - If AfterEach method exists insert a close statement for the MockWebServer and throws for IOException - If AfterEach does not exist then insert new afterEachTest method closing MockWebServer
    • Field Summary

      • Fields inherited from class org.openrewrite.Recipe

        NOOP
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected @Nullable org.openrewrite.TreeVisitor<?,​org.openrewrite.ExecutionContext> getApplicableTest()  
      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, 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

      • UpdateMockWebServer

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

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

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