Skip to content

Fix the Java test classpath — main is currently red - #6

Merged
rosenazeri merged 1 commit into
mainfrom
fix/java-test-classpath
Oct 23, 2026
Merged

rosenazeri merged 1 commit into
mainfrom
fix/java-test-classpath

Conversation

@rosenazeri

Copy link
Copy Markdown
Contributor

main does not compile its tests. CI caught it the moment Actions was enabled — exactly the failure the PR description warned about when I shipped the Java branch unbuilt.

What was broken

Two Spring Boot 4 differences I could not see without a working build:

  1. com.fasterxml.jackson.databind is not pulled in by spring-boot-starter-webmvc. The main sources only touch jackson-annotations, so they compiled; every test that reads a response as a JsonNode did not.
  2. org.springframework.boot.test.autoconfigure.web.servlet no longer exists under that name, so @AutoConfigureMockMvc and MockMvc could not resolve.

The fix

  • jackson-databind added as a test dependency, version managed by the Boot BOM.
  • OrderApiTest rewritten: @SpringBootTest(webEnvironment = RANDOM_PORT) starts the real application on a random port and the JDK HTTP client drives it. Same six behaviours asserted, no dependency on any test-autoconfiguration package — and it now matches how the Go, Python and C# starters test.

Also kept

The CI step that echoes Maven errors and the surefire reports as annotations. It does nothing on a green build and saves downloading a log on a red one.


Generated by Claude Code

main was red: every test source failed to compile.

- com.fasterxml.jackson.databind is absent from Spring Boot 4's webmvc
  starter, and the tests read responses as a JsonNode. Added as a test
  dependency, version managed by the Boot BOM.
- org.springframework.boot.test.autoconfigure.web.servlet no longer exists
  under that name, so @AutoConfigureMockMvc and MockMvc could not resolve.
  OrderApiTest now starts the application on a random port with
  @SpringBootTest(webEnvironment = RANDOM_PORT) and drives it over real
  HTTP with the JDK client. It asserts the same six behaviours and no
  longer depends on any test-autoconfiguration package, which also brings
  it in line with how the other three starters test.

Keeps the CI step that echoes Maven errors and surefire reports as
annotations: it costs nothing on a green build and saves a log download
on a red one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017dJtYEDWbTTGw5wfTZ4nPX
@rosenazeri
rosenazeri merged commit 6c8ecbf into main Oct 23, 2026
1 check passed
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.

2 participants