Implement unit test plan: 109 tests across 17 test classes#191
Open
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
Open
Implement unit test plan: 109 tests across 17 test classes#191devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
Conversation
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>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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>
…tion strategy Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 pathCourierTest(9 tests): availability, location, delivery trackingPlanTest(4 tests): action add/remove, delivery filteringRestaurantTest(3 tests): menu item lookup, revise guardPhase 2 — Common Module (
ftgo-common)AddressTest(3 tests): constructors, settersErrorResponseTest(2 tests): field population, auto-timestampPersonNameTest(2 tests): storage, JSON round-tripPhase 3 — Service Layer (Mockito)
OrderServiceTest(11 tests): create, cancel, accept, state transitions, delivery schedulingConsumerServiceTest(5 tests): create, find, validateCourierServiceTest(5 tests): create, availability, location updatePhase 4 — Controller Layer (MockMvc / RestAssured)
OrderControllerTest(6 tests): expanded with create, cancel, accept, list-by-consumerConsumerControllerTest(3 tests): create, get, 404CourierControllerTest(5 tests): create, get, availability, location, workloadRestaurantControllerTest(3 tests): create, get, 404Phase 5 — Cross-cutting
ApiTrackingInterceptorTest(6 tests): correlation ID generation/propagation, persistence, error handlingApiRequestLogTest(3 tests): creation, completion with/without errorGlobalExceptionHandlerTest(7 tests): all 7 exception handler methodsBuild fixes for Java 17 compatibility
--add-opensJVM args for test tasksmockito-coretoftgo-domaintest dependenciesftgo-end-to-end-tests-commondependency inftgo-applicationwithspring-boot-starter-testFtgoApplicationTest(requires unavailableeventuate-util-test)Review & Testing Checklist for Human
./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:compileTestJavaand verify 109 tests passftgo-application/build.gradlechange (commenting outftgo-end-to-end-tests-common) is acceptableNotes
FtgoApplicationTestwas already broken before this PR due to the missingeventuate-util-test:0.1.0.RELEASE(Bintray repos are defunct). This PR makes that exclusion explicit rather than letting it fail at dependency resolution.Link to Devin session: https://app.devin.ai/sessions/28e64748218d46deb9d49141f64df356
Requested by: @tobydrinkall
Devin Review