Skip to content

Commit 92de89a

Browse files
Fix UpdateMockWebServerDispatcher classpath lookup (#975)
The recipe asked for `okhttp-4.10` via `classpathFromResources`, but that artifact is only bundled in the test type table — production runs of the recipe (e.g. via the Moderne CLI) fail with `IllegalArgumentException: Unable to find classpath resource dependencies beginning with: 'okhttp-4.10'` whenever a project has `mockwebserver` on its classpath. The template snippet only references `MockResponse` and `.build()` (itself a 5.x-only method, so the parser is already lenient about unresolved members), so dropping the unused `okhttp-4.10` request is sufficient and matches the sister `UpdateMockWebServerMockResponse` recipe, which uses just `mockwebserver3`.
1 parent 64260b8 commit 92de89a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/openrewrite/java/testing/junit5/UpdateMockWebServerDispatcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public J.Return visitReturn(J.Return aReturn, ExecutionContext c) {
9898
}
9999
J.MethodInvocation wrapped = JavaTemplate
100100
.builder("#{any(" + OLD_MOCK_RESPONSE_FQN + ")}.build()")
101-
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(c, "mockwebserver-4.10", "okhttp-4.10"))
101+
.javaParser(JavaParser.fromJavaVersion().classpathFromResources(c, "mockwebserver-4.10"))
102102
.build()
103103
.apply(new Cursor(getCursor(), expr), expr.getCoordinates().replace(), expr);
104104
wrapped = wrapped.withMethodType(buildMethodType)

0 commit comments

Comments
 (0)