You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unique Spring test contexts still boot a full application #315
The 2026-10-21 H2 run spent about 211s between JUnit suite timestamps. That gap is context startup (maxParallelForks = 1). These classes each force a context the shared @SpringBootTest + @AutoConfigureMockMvc cache cannot reuse. Suite method time for each one is under a second.
Class
Mechanism
Gap before the suite
ResetPasswordControllerTest
Profiles.MAIL and @Import(MockMailConfig.class)
16.43s
TemplateMoreInfoAdvancedRenderSecurityTest
@MockitoBean TemplateExecutionService
15.79s
UserPositionRepositoryDataRestTest
@AutoConfigureWebMvc and @AutoConfigureTestDatabase(NONE) while the other Data REST tests use @AutoConfigureMockMvc
14.73s
JsonWebTokenServiceTest
@AdditiveActiveProfiles(Profiles.TEST) and @Import(FixedClockConfig.class). The tests call JsonWebTokenService only
13.91s
SpatialReferenceSystemTest
extends BaseTest and @MockitoBean CodeListValueRepository
12.01s
UserChecksServiceTest
@SpringBootTest plus mocked repositories, then userChecksService.getWarnings
11.30s
UserPositionBusinessLogicTest
nested @Import of the business-logic class
6.16s
DefaultLanguageChangeControllerTest
extends BaseTest and @MockitoBean DefaultLanguageChangeService
4.93s
TaskLiteralEnrollmentDataRestTest
@MockitoSpyBean LiteralTranslationEnsureService
4.83s
DatabaseConnectionControllerTest
extends BaseTest and @MockitoBean DatabaseConnectionRepository
4.67s
CodeListTest is the same shape as SpatialReferenceSystemTest and paid 10.17s. Leave it on BaseTest.
Why this is not a test-only edit
A @WebMvcTest or plain unit move changes which beans and filters run. The mock, profile, or spy is the cache key and also the behavior under test. TaskLiteralEnrollmentDataRestTest needs the spy to throw on one method and the real enroll path on the other.
Done when
Each class either shares an existing context or documents why its context must stay unique. A wrong observable result still fails the test.
A later H2 run on the same day, 08:04:19Z to 08:06:49Z, measured these gaps again after the empty i18n nested configurations were hoisted. Method time for the ten classes is still under a second. The gaps are smaller than the 211s total in the issue, and these classes still do not share the warm BaseTest context.
CodeListTest (5.00s) and SpatialReferenceSystemTest (6.12s) extend BaseTest and add @MockitoBean CodeListValueRepository. The field names differ (codeListValueRepository and repository), so they are two cache keys. HttpURLTest, MinMaxTest, and BoundingBoxTest reuse BaseTest at about 0s.
The seed already has the answers those stubs force. STM_CODELIST.csv legend types are LINK, LEGENDGRAPHIC, and CAPABILITIES, so WRONG VALUE is absent. service.type includes WMS. @Srs checks the EPSG: pattern in SrsSystemListValidator, not the code list. Dropping the mock keeps both classes on BaseTest. That is not a @WebMvcTest move. CodeListTest staying on BaseTest still holds.
The other classes in this issue still need the mock, profile, or spy that the assertion reads. Do not fold them into this comment's smaller edit.
The working tree removes @DirtiesContext from UserPositionBusinessLogicTest and UserPositionRepositoryDataRestTest. Both classes still have the cache key named in this issue. CodeListTest still has @MockitoBean CodeListValueRepository. The pass method that expected no $.errors[?(@.property)] match is gone. The remaining method still stubs that repository, so the 5.00s gap is unchanged by that deletion.
Activity
fjlopez commentedon Oct 21, 2026
A later H2 run on the same day, 08:04:19Z to 08:06:49Z, measured these gaps again after the empty i18n nested configurations were hoisted. Method time for the ten classes is still under a second. The gaps are smaller than the 211s total in the issue, and these classes still do not share the warm
BaseTestcontext.CodeListTest(5.00s) andSpatialReferenceSystemTest(6.12s) extendBaseTestand add@MockitoBean CodeListValueRepository. The field names differ (codeListValueRepositoryandrepository), so they are two cache keys.HttpURLTest,MinMaxTest, andBoundingBoxTestreuseBaseTestat about 0s.The seed already has the answers those stubs force.
STM_CODELIST.csvlegend types areLINK,LEGENDGRAPHIC, andCAPABILITIES, soWRONG VALUEis absent.service.typeincludesWMS.@Srschecks theEPSG:pattern inSrsSystemListValidator, not the code list. Dropping the mock keeps both classes onBaseTest. That is not a@WebMvcTestmove.CodeListTeststaying onBaseTeststill holds.The other classes in this issue still need the mock, profile, or spy that the assertion reads. Do not fold them into this comment's smaller edit.
fjlopez commentedon Oct 21, 2026
The working tree removes
@DirtiesContextfromUserPositionBusinessLogicTestandUserPositionRepositoryDataRestTest. Both classes still have the cache key named in this issue.CodeListTeststill has@MockitoBean CodeListValueRepository. The pass method that expected no$.errors[?(@.property)]match is gone. The remaining method still stubs that repository, so the 5.00s gap is unchanged by that deletion.fjlopez commentedon Oct 22, 2026
Fixed on dev by #351.