Skip to content

Implement unit test plan: 109 tests across 17 test classes#191

Open
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin/1777556735-implement-unit-tests
Open

Implement unit test plan: 109 tests across 17 test classes#191
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin/1777556735-implement-unit-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 30, 2026

Summary

Implements the full UNIT_TEST_PLAN.md — all 5 phases covering domain model, common module, service layer, controller layer, and cross-cutting concerns. 109 tests across 17 test classes, all passing locally on a clean build.

Phase 1 — Domain Model (pure logic, ftgo-domain)

  • OrderTest (16 tests): state transitions, cancellation, scheduling, full happy path
  • CourierTest (9 tests): availability, location, delivery tracking
  • PlanTest (4 tests): action add/remove, delivery filtering
  • RestaurantTest (3 tests): menu item lookup, revise guard

Phase 2 — Common Module (ftgo-common)

  • AddressTest (3 tests): constructors, setters
  • ErrorResponseTest (2 tests): field population, auto-timestamp
  • PersonNameTest (2 tests): storage, JSON round-trip

Phase 3 — Service Layer (Mockito)

  • OrderServiceTest (11 tests): create, cancel, accept, state transitions, delivery scheduling
  • ConsumerServiceTest (5 tests): create, find, validate
  • CourierServiceTest (5 tests): create, availability, location update

Phase 4 — Controller Layer (MockMvc / RestAssured)

  • OrderControllerTest (6 tests): expanded with create, cancel, accept, list-by-consumer
  • ConsumerControllerTest (3 tests): create, get, 404
  • CourierControllerTest (5 tests): create, get, availability, location, workload
  • RestaurantControllerTest (3 tests): create, get, 404

Phase 5 — Cross-cutting

  • ApiTrackingInterceptorTest (6 tests): correlation ID generation/propagation, persistence, error handling
  • ApiRequestLogTest (3 tests): creation, completion with/without error
  • GlobalExceptionHandlerTest (7 tests): all 7 exception handler methods

Build fixes for Java 17 compatibility

  • Upgraded Mockito to 4.11.0 and ByteBuddy to 1.14.11 via resolution strategy
  • Added --add-opens JVM args for test tasks
  • Added mockito-core to ftgo-domain test dependencies
  • Replaced broken ftgo-end-to-end-tests-common dependency in ftgo-application with spring-boot-starter-test
  • Excluded FtgoApplicationTest (requires unavailable eventuate-util-test)

Review & Testing Checklist for Human

  • Run ./gradlew clean test -x :ftgo-end-to-end-tests-common:compileJava -x :ftgo-end-to-end-tests:compileJava -x :ftgo-end-to-end-tests-common:test -x :ftgo-end-to-end-tests:test -x :ftgo-end-to-end-tests-common:compileTestJava -x :ftgo-end-to-end-tests:compileTestJava and verify 109 tests pass
  • Review the Mockito/ByteBuddy version upgrade doesn't conflict with existing test infrastructure
  • Verify the ftgo-application/build.gradle change (commenting out ftgo-end-to-end-tests-common) is acceptable

Notes

  • The existing FtgoApplicationTest was already broken before this PR due to the missing eventuate-util-test:0.1.0.RELEASE (Bintray repos are defunct). This PR makes that exclusion explicit rather than letting it fail at dependency resolution.
  • All new tests are JUnit 4 to match the existing test style in the project.

Link to Devin session: https://app.devin.ai/sessions/28e64748218d46deb9d49141f64df356
Requested by: @tobydrinkall


Devin Review

Status Commit
⚪ Not started

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

Phase 1 - Domain Model (pure logic):
- OrderTest: 16 tests covering state transitions, cancellation, scheduling
- CourierTest: 9 tests for availability, location, delivery tracking
- PlanTest: 4 tests for action management and delivery filtering
- RestaurantTest: 3 tests for menu item lookup and revise guard

Phase 2 - Common Module (value objects):
- AddressTest: 3 tests for constructors and setters
- ErrorResponseTest: 2 tests for field population and timestamp
- PersonNameTest: 2 tests for storage and JSON serialization

Phase 3 - Service Layer (with Mockito):
- OrderServiceTest: 11 tests for CRUD, state transitions, delivery scheduling
- ConsumerServiceTest: 5 tests for create, find, validate
- CourierServiceTest: 5 tests for create, availability, location

Phase 4 - Controller Layer (MockMvc/RestAssured):
- OrderControllerTest: expanded with 4 new tests (create, cancel, accept, list)
- ConsumerControllerTest: 3 tests for create and get endpoints
- CourierControllerTest: 5 tests for CRUD and workload endpoints
- RestaurantControllerTest: 3 tests for create and get endpoints

Phase 5 - Cross-cutting:
- ApiTrackingInterceptorTest: 6 tests for correlation ID and persistence
- ApiRequestLogTest: 3 tests for log creation and completion
- GlobalExceptionHandlerTest: 7 tests for all exception handler methods

Build fixes:
- Upgrade Mockito 2.x -> 4.11.0 and ByteBuddy -> 1.14.11 for Java 17 compat
- Add --add-opens JVM args for test tasks
- Add mockito-core to ftgo-domain test dependencies
- Replace broken e2e test dependency in ftgo-application with spring-boot-starter-test
- Exclude FtgoApplicationTest (requires unavailable eventuate-util-test)

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

The mock was returning the order without transitioning its state,
so the test was vacuously asserting APPROVED instead of CANCELLED.

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
devin-ai-integration[bot]

This comment was marked as resolved.

…tion strategy

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant