Class UpdateMockWebServer
java.lang.Object
org.openrewrite.Recipe
org.openrewrite.java.testing.junit5.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, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> Methods inherited from class org.openrewrite.Recipe
addApplicableTest, addSingleSourceApplicableTest, causesAnotherCycle, doNext, equals, getApplicableTest, getApplicableTests, getDescriptor, getJacksonPolymorphicTypeTag, getLanguages, getName, getRecipeList, getSingleSourceApplicableTests, getTags, hashCode, noop, run, run, run, run, validate, validate, validateAll, validateAll, visit
-
Constructor Details
-
UpdateMockWebServer
public UpdateMockWebServer()
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Overrides:
getDescriptionin classorg.openrewrite.Recipe
-
getEstimatedEffortPerOccurrence
- Overrides:
getEstimatedEffortPerOccurrencein classorg.openrewrite.Recipe
-
getSingleSourceApplicableTest
protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getSingleSourceApplicableTest()- Overrides:
getSingleSourceApplicableTestin classorg.openrewrite.Recipe
-
getVisitor
protected org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-