116 lines
4.5 KiB
Markdown
116 lines
4.5 KiB
Markdown
# Test Evidence: Targeted Project Lombok boilerplate
|
|
|
|
- **Test type:** Unit
|
|
- **Requirement IDs:** `ARC-002`, `ARC-005`, `ARC-006`, `TST-001`
|
|
- **Scenario IDs:** `AC-TST-001`
|
|
- **Test class/method:** `com.lab.labtimesheet.feature.project.repository.ProjectLombokBoilerplateTest#eligibleConstructorsUseTargetedLombokWithoutChangingDomainApis`
|
|
- **Implementation commit:** `e5639c1`
|
|
|
|
## Protected behavior
|
|
|
|
Project Spring components use targeted required-argument constructor generation only when their
|
|
constructors assign required final dependencies. Project JPA entities use only protected no-arg
|
|
constructor generation. Records remain records, and entity identity, lazy associations, explicit
|
|
domain accessors, aggregate constructors, and mutation methods do not gain broad generated APIs.
|
|
|
|
## Test method
|
|
|
|
The source-contract test inspects only `feature.project` production sources. It requires
|
|
`@RequiredArgsConstructor` on the three injection-only components, removes the stateless advice's
|
|
handwritten no-arg constructor, and requires protected `@NoArgsConstructor` on the three JPA
|
|
entities. It also rejects broad entity Lombok annotations, confirms representative explicit domain
|
|
APIs remain, and verifies every Project immutable DTO/value type remains a Java record.
|
|
|
|
## Hand-derived expected result
|
|
|
|
Seven handwritten constructors are mechanical and eligible for removal: three dependency-assignment
|
|
constructors, one empty advice constructor, and three empty protected JPA constructors. The three
|
|
entity domain constructors, all aggregate mutation methods, defensive-copy accessors, derived
|
|
membership/leadership accessors, validation constructors, exception constructors, and all thirteen
|
|
records must remain explicit or remain records because they carry behavior or preserve the existing
|
|
API shape.
|
|
|
|
## RED
|
|
|
|
**Command**
|
|
|
|
```text
|
|
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
|
export PATH="/opt/homebrew/opt/node@24/bin:$JAVA_HOME/bin:$PATH"
|
|
./mvnw -Dtest=ProjectLombokBoilerplateTest test
|
|
```
|
|
|
|
**Observed result**
|
|
|
|
```text
|
|
[INFO] Running com.lab.labtimesheet.feature.project.repository.ProjectLombokBoilerplateTest
|
|
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
|
|
ProjectLombokBoilerplateTest.eligibleConstructorsUseTargetedLombokWithoutChangingDomainApis
|
|
expected ProjectController.java to contain import lombok.RequiredArgsConstructor; and
|
|
@RequiredArgsConstructor, but neither was present and the handwritten assignment-only constructor
|
|
remained.
|
|
[INFO] BUILD FAILURE
|
|
```
|
|
|
|
## GREEN
|
|
|
|
**Command**
|
|
|
|
```text
|
|
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
|
export PATH="/opt/homebrew/opt/node@24/bin:$JAVA_HOME/bin:$PATH"
|
|
./mvnw -Dtest=ProjectLombokBoilerplateTest test
|
|
```
|
|
|
|
**Observed result**
|
|
|
|
```text
|
|
[INFO] Running com.lab.labtimesheet.feature.project.repository.ProjectLombokBoilerplateTest
|
|
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
|
|
[INFO] BUILD SUCCESS
|
|
```
|
|
|
|
## Affected suite
|
|
|
|
**Command and result**
|
|
|
|
```text
|
|
export JAVA_HOME=/opt/homebrew/opt/openjdk@25
|
|
export PATH="/opt/homebrew/opt/node@24/bin:$JAVA_HOME/bin:$PATH"
|
|
./mvnw -DskipTests compile
|
|
[INFO] BUILD SUCCESS
|
|
|
|
./mvnw -Dtest=ProjectLombokBoilerplateTest,ProjectEntityTest,ProjectPersistenceStructureTest,ProjectTaskMutationContextTest test
|
|
[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
|
|
[INFO] BUILD SUCCESS
|
|
|
|
./mvnw -Dtest=ProjectControllerTest test
|
|
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0
|
|
[INFO] BUILD SUCCESS
|
|
|
|
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
|
|
./mvnw -Dtest=ProjectServiceIntegrationTest test
|
|
[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0
|
|
[INFO] BUILD SUCCESS
|
|
|
|
./mvnw -Dtest='Project*Test' test
|
|
[INFO] Tests run: 45, Failures: 0, Errors: 0, Skipped: 0
|
|
[INFO] BUILD SUCCESS
|
|
|
|
./mvnw -DskipTests -Dmaven.javadoc.failOnWarnings=true -Ddoclint=all \
|
|
-Dsubpackages=com.lab.labtimesheet.feature.project javadoc:javadoc
|
|
[INFO] BUILD SUCCESS
|
|
|
|
git diff --check
|
|
(no output; exit 0)
|
|
```
|
|
|
|
## External-test boundaries
|
|
|
|
The source audit does not by itself prove Lombok annotation processing, Spring constructor
|
|
injection, Hibernate materialization, PostgreSQL mappings, Thymeleaf behavior, Project authorization,
|
|
locking, or aggregate lifecycle rules. Those boundaries are covered by the compile, scoped
|
|
Javadoc/doclint, Project unit/web, and PostgreSQL 18.4 integration gates above. The first sandboxed
|
|
unit-suite attempt could not attach Mockito's Byte Buddy agent; the unchanged command passed after
|
|
approved execution outside that sandbox. Browser E2E behavior remains outside this unit milestone.
|