Skip to content

Library doesn't work in @WebMvcTest #926

Open
@remal

Description

@remal

Description

I'd like to test that my exceptions and handled correctly and application/problem+json response is returned.

For that, I write tests annotated with @WebMvcTest.

Expected Behavior

Auto-configurations from org.zalando:problem-spring-web-autoconfigure are included in the test context.

Actual Behavior

Auto-configurations from org.zalando:problem-spring-web-autoconfigure are NOT included in the test context.

Possible Fix

Copy content of META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports into:

  • META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports - to support @WebMvcTest
  • META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports - to support @WebFluxTest

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions