test: drive filter inside embedded Jetty#2
Open
marcin-prerender wants to merge 1 commit into
Open
Conversation
Mockito mocks on HttpServletRequest/Response don't exercise the real servlet container: filter chain wiring, URL/query construction, status and header propagation, static-asset pass-through are all simulated. Boot Jetty on a free port, register PrerenderFilter via FilterHolder with init params, mount a tiny servlet for the pass-through case, and hit the whole thing with a real HttpClient. Upstream Prerender service remains faked with the already-present WireMock. Jetty pinned to 11.0.20 to match WireMock 3.5.4's transitive version and avoid a classpath conflict with Jetty 12. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #1 (
add-prerender-java). Will auto-retarget tomainonce #1 merges.What
Replace Mockito-on-servlet-objects with embedded Jetty + a real
HttpClientso the filter is exercised through a real servlet container. Upstream Prerender service remains faked with the already-present WireMock.Why
Mocked
HttpServletRequest/HttpServletResponsedon't exercise:Closes the "java is the only repo without real-framework testing" gap, alongside the matching django change.
Notes
11.0.20(not 12.x) to match WireMock 3.5.4's transitive Jetty version and avoid a classpath conflict.mvn test→ 12 passed (7 Jetty smoke + 5 contract).🤖 Generated with Claude Code