Files
labtimesheet/docs/tests/unit/lombok-attendance-boilerplate.md
T

4.0 KiB
Raw Blame History

Test Evidence: Attendance targeted Lombok boilerplate retrofit

  • Test type: Unit source-contract audit
  • Requirement IDs: ATT-001ATT-012, CAL-001, CAL-006CAL-009
  • Scenario IDs: AC-ATT-001AC-ATT-005, AC-CAL-003, AC-CAL-004
  • Test class/method: com.lab.labtimesheet.feature.attendance.AttendanceLombokBoilerplateTest
  • Implementation commit: 82ad8202fd31f77db8c3932a902dba07cee70894

Protected behavior

Attendance uses the installed Lombok processor only for mechanical constructors while preserving package-level Spring injection access, protected JPA construction, immutable records, domain constructors and mutations, raw punch and attached-policy history rules, composite-key identity, and existing public API names.

Test method

The source-contract test inspects only feature.attendance production Java. It enumerates the exact injection-only components and JPA/stateless no-argument constructors eligible for Lombok, rejects retained handwritten equivalents and blanket @Data, and asserts that records and business-significant methods remain explicit.

Hand-derived expected result

Five injection-only components use package-scoped @RequiredArgsConstructor; six JPA/embeddable types use protected @NoArgsConstructor; the stateless domain service uses a package-scoped @NoArgsConstructor. No record is replaced, and no validated constructor, state mutation, identity method, or stable domain-style accessor is generated away.

RED

Command

export JAVA_HOME=/opt/homebrew/opt/openjdk@25
export PATH="$JAVA_HOME/bin:$PATH"
./mvnw -Dtest=AttendanceLombokBoilerplateTest test

Observed result

Tests run: 3, Failures: 2, Errors: 0, Skipped: 0
The injection-component assertion first failed on AttendanceController because the required package-scoped
@RequiredArgsConstructor and Lombok imports were absent. The JPA/stateless assertion first failed on
AttendancePolicyEntity because the protected @NoArgsConstructor and Lombok imports were absent. The record and
business-method retention guard passed.
BUILD FAILURE
Process exited 1.

GREEN

Command

export JAVA_HOME=/opt/homebrew/opt/openjdk@25
export PATH="$JAVA_HOME/bin:$PATH"
./mvnw -Dtest=AttendanceLombokBoilerplateTest test

Observed result

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
Process exited 0.

Affected suite

Command and result

export JAVA_HOME=/opt/homebrew/opt/openjdk@25
export PATH="$JAVA_HOME/bin:$PATH"
export DOCKER_HOST=unix:///Users/sechmachine/.orbstack/run/docker.sock
./mvnw -Dtest='*Attendance*Test' test
Tests run: 38, Failures: 0, Errors: 0, Skipped: 0
PostgreSQL 18.4 started and Flyway applied V1 for the persistence and concurrency contexts.
BUILD SUCCESS
Process exited 0.

External-test boundaries

The source audit does not replace compilation, reflection/JPA bootstrapping, MVC property access, PostgreSQL persistence, or Javadoc/doclint. Those checks are required as affected verification after the source contract turns GREEN. No application behavior or public API is intentionally changed by this retrofit.

Additional verification on the same source tree:

./mvnw -DskipTests compile
BUILD SUCCESS

./mvnw -Dtest=AttendanceLombokBoilerplateTest,AttendanceLayerStructureTest,AttendancePolicyTest,AttendanceServiceTest,AttendanceApplicationServiceTest,AttendanceControllerTest test
Tests run: 27, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

./mvnw -Dtest=AttendancePersistenceIntegrationTest,AttendanceConcurrencyIntegrationTest test
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
PostgreSQL 18.4; BUILD SUCCESS

javadoc -quiet -Xdoclint:all -d target/attendance-javadocs -classpath "target/classes:<Maven dependency classpath>" -sourcepath src/main/java -subpackages com.lab.labtimesheet.feature.attendance
Process exited 0. The source frontend reported seven generated-constructor missing-comment warnings because it does not
expand Lombok constructors; repository policy exempts generated trivial constructors from duplicate Javadoc.