Skip to content

Commit 0d441a2

Browse files
committed
test: 컨트롤러 테스트와 불필요한 테스트 더블 정리
1 parent 58ca270 commit 0d441a2

12 files changed

Lines changed: 61 additions & 1015 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
module: test
3+
problem_type: test-failures
4+
tags:
5+
- mockito
6+
- injectmocks
7+
- unit-test
8+
---
9+
10+
# Prefer manual SUT construction when only real collaborators are needed
11+
12+
## Context
13+
14+
Some unit tests used `@InjectMocks` with extra `@Mock` or `@Spy` fields only to satisfy constructor injection. That left unused test doubles in the file and made the test setup noisier than the assertions.
15+
16+
## Decision
17+
18+
When a collaborator does not need stubbing or verification, prefer constructing the SUT manually with a real instance or a no-op implementation.
19+
20+
## Applied here
21+
22+
- `LockerSearchResultQueryServiceTest` now constructs the service manually and uses only the doubles it actually asserts against.
23+
- `LockerSearchQueryServiceTest` now constructs the service manually and uses a real `LockerSearchAssembler` instead of an unused spy.
24+
25+
## Guardrail
26+
27+
If a mock or spy is never stubbed or verified, remove it first and consider replacing `@InjectMocks` with explicit SUT construction.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
module: test
3+
problem_type: test-failures
4+
tags:
5+
- controller-test
6+
- cleanup
7+
- verification
8+
---
9+
10+
# Remove controller tests only after targeted pass
11+
12+
## Context
13+
14+
When deleting a broad class of tests, first verify that the exact target set currently passes. Otherwise cleanup can hide unrelated failures behind a large diff.
15+
16+
## Applied here
17+
18+
- enumerated `*Controller*Test` and `*ControllerTest`
19+
- ran only those tests first
20+
- removed them after a successful targeted run
21+
- rechecked test-source compilation after deletion
22+
23+
## Guardrail
24+
25+
For future bulk test cleanup, identify the exact files, run them in isolation, then delete and verify compilation again.

src/test/java/com/zimdugo/admin/entrypoint/AdminDocumentControllerTest.java

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/test/java/com/zimdugo/admin/entrypoint/AdminDocumentTranslationReviewControllerTest.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/test/java/com/zimdugo/admin/entrypoint/AdminLockerControllerTest.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/test/java/com/zimdugo/admin/entrypoint/AdminLockerReportControllerTest.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)