Class UpdateMockWebServer

java.lang.Object
org.openrewrite.Recipe
org.openrewrite.java.testing.junit5.UpdateMockWebServer
All Implemented Interfaces:
Cloneable

public class UpdateMockWebServer extends org.openrewrite.Recipe
Recipe for converting JUnit 4 okhttp3 MockWebServer Rules with their JUnit 5 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

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openrewrite.Recipe

    org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe
  • Field Summary

    Fields inherited from class org.openrewrite.Recipe

    contributors, examples, PANIC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    List<org.openrewrite.Recipe>
     
    org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext>
     

    Methods inherited from class org.openrewrite.Recipe

    addDataTable, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UpdateMockWebServer

      public UpdateMockWebServer()
  • Method Details

    • getDisplayName

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

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getVisitor

      public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()
      Overrides:
      getVisitor in class org.openrewrite.Recipe
    • getRecipeList

      public List<org.openrewrite.Recipe> getRecipeList()
      Overrides:
      getRecipeList in class org.openrewrite.Recipe