-
Amended code:
@Disabled("FIXIT SZ-35: ApplicationContext bootstrap failure – see issue SZ-35") @WebMvcTest(controllers = PullRequestController.class) @AutoConfigureMockMvc(addFilters = false) @Import(GlobalExceptionHandler.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) class PullRequestControllerTest { ... } -
| Type |
Bug
|
| Priority |
Normal
|
| Assignee | |
| Version |
1.0
|
| Sprints |
n/a
|
| Customer |
n/a
|
Issue Votes (0)
Description
PullRequestControllerTestconsistently fails to initialize the SpringApplicationContextduring test startup with the following exception:The error occurs before any controller logic executes.
Stack traces show the test context being loaded via:
This indicates that
@WebMvcTestis not using its intended lightweight slice loader but instead triggering a full Spring Boot application context, causing initialization failure.Observed Behavior
PullRequestControllerTestfail with identical context load errors.WebMvcTestContextBootstrapper=true) that forces the wrongContextLoader.MockMvcinteraction.Expected Behavior
@WebMvcTest(PullRequestController.class)should initialize a minimal web slice context with:MockMvcGlobalExceptionHandlerand should not attempt to start the full Spring Boot application context.
Impact
PullRequestControllerTestonlyTemporary Workaround
Disable the entire test class:
This preserves suite stability while the root cause is investigated.
Next Steps
"WebMvcTestContextBootstrapper=true".@TestPropertySourceor external configuration injects internal Boot flags.@WebMvcTestdefaults to the proper loader (AnnotationConfigContextLoader).Estimate: 2h
Priority: Medium
Status: OPEN
Assignee: Rk
File:
backend/src/test/java/com/sztab/controller/PullRequestControllerTest.java