Skip to content

test: drive filter inside embedded Jetty#2

Open
marcin-prerender wants to merge 1 commit into
add-prerender-javafrom
embedded-jetty-smoke
Open

test: drive filter inside embedded Jetty#2
marcin-prerender wants to merge 1 commit into
add-prerender-javafrom
embedded-jetty-smoke

Conversation

@marcin-prerender
Copy link
Copy Markdown

Stacked on top of #1 (add-prerender-java). Will auto-retarget to main once #1 merges.

What

Replace Mockito-on-servlet-objects with embedded Jetty + a real HttpClient so the filter is exercised through a real servlet container. Upstream Prerender service remains faked with the already-present WireMock.

Why

Mocked HttpServletRequest/HttpServletResponse don't exercise:

  • Filter chain wiring through the container
  • URL/query construction from real servlet plumbing
  • Status and header propagation through the container's response handling
  • Static-asset pass-through behaviour with a real downstream servlet

Closes the "java is the only repo without real-framework testing" gap, alongside the matching django change.

Notes

  • Jetty pinned to 11.0.20 (not 12.x) to match WireMock 3.5.4's transitive Jetty version and avoid a classpath conflict.
  • All 7 existing scenarios preserved + 0 new — the contract tests (separate file) already cover the new header/protocol assertions.
  • Local run: mvn test → 12 passed (7 Jetty smoke + 5 contract).

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant