lukaszlenart opened a new pull request, #1956: URL: https://github.com/apache/struts/pull/1956
Fixes [WW-3353](https://issues.apache.org/jira/browse/WW-3353) `StrutsRestTestCase` (added by WW-4549 as the answer to this ticket) has never had a test and could not actually run a REST action to completion. Two defects, each watched failing before the fix: 1. **`initServletMockObjects()` order** — the `MockServletContext` was built *before* `ConventionPluginResourceLoader` was assigned, so the loader was a dead assignment and Convention could not resolve results under `/WEB-INF/content`: `No result defined for action org.demo.rest.example.OrdersController and result show`. Creating the loader first fixes it. 2. **Missing `spring-web`** — `spring-test`'s `MockHttpServletResponse` needs `org.springframework.http.MediaType`, and the plugin only reached `spring-web` through its *optional* `struts2-spring-plugin` dependency. A project following the docs (Spring plugin only for Spring-managed actions) got `NoClassDefFoundError` on the first test. Declared directly; the version is BOM-managed and already resolved transitively elsewhere. Adds `OrdersControllerRestTestCaseTest` in `apps/rest-showcase` — the first coverage of `StrutsRestTestCase` — executing `GET /orders/3` through the proxy (id bound from the path, Convention result resolved) and rendering `/orders/3.json`. The showcase POM gets the junit plugin at `test` scope and the servlet/JSP APIs at `provided` scope, as `apps/showcase` already declares. On the ticket's original symptom ("`/orders/3` doesn't call `setId`"): the attached test called `action.show()` directly without `proxy.execute()`, so no interceptor ran; with `execute()` the id binds even on the plain test case. The title claim was still true, for the two reasons above. Verified: `mvn test -pl apps/rest-showcase -Dtest=OrdersControllerRestTestCaseTest` (2/2) and the junit plugin's own suite (12/12). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
