Add comprehensive test coverage for Consumer, Restaurant, Courier services and expand Order tests#187
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Conversation
…vices and expand Order tests - Add domain entity tests: OrderTest, CourierTest, RestaurantTest, ConsumerTest - Add service layer tests: ConsumerServiceTest, RestaurantServiceTest, CourierServiceTest, OrderServiceTest - Add controller tests: ConsumerControllerTest, RestaurantControllerTest, CourierControllerTest - Expand OrderControllerTest with 11 new endpoint tests (create, cancel, revise, accept, lifecycle) - Add test data factories: ConsumerMother, CourierMother - Update build.gradle files with test dependencies for consumer, restaurant, courier services - Fix Mockito/ByteBuddy Java 21 compatibility via dependency resolution strategy Co-Authored-By: benc <Benc@windsurf.com>
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:
|
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
Adds ~1500 lines of test code covering three previously untested services (Consumer, Restaurant, Courier), a new
OrderServiceunit test, expandedOrderControllerendpoint tests, and domain entity unit tests. Also introduces test data factories (ConsumerMother,CourierMother) and updates build infrastructure for test dependencies.New test files (14):
OrderTest,CourierTest,RestaurantTest,ConsumerTest— state machine transitions, creation, validationConsumerServiceTest,RestaurantServiceTest,CourierServiceTest,OrderServiceTest— mocked repository interactionsConsumerControllerTest,RestaurantControllerTest,CourierControllerTest— RestAssured MockMvc tests;OrderControllerTestexpanded with 11 new endpoint tests (create, cancel, revise, accept, preparing, ready, pickedup, delivered)ConsumerMother,CourierMotherBuild changes:
build.gradle: Forces Mockito 4.11.0 + ByteBuddy 1.14.12 viaconfigurations.all { resolutionStrategy }to fix Java 21 compatibility (Mockito 2.x bundled with Spring Boot 2.0.3 cannot mock interfaces on Java 21)ftgo-consumer-service/build.gradleandftgo-restaurant-service/build.gradle: Migrated from deprecatedcom.jayway.restassuredtoio.rest-assured:3.0.6, addedspring-mock-mvcandftgo-test-utildependenciesftgo-domain/build.gradle: Addedmockito-coretest dependencyReview & Testing Checklist for Human
build.gradle: Theconfigurations.all { resolutionStrategy { force ... } }applies to ALL configurations (compile + runtime), not just test. Verify this doesn't affect production runtime behavior. Consider scoping totestImplementation/testCompileonly if possible.ftgo-consumer-serviceandftgo-restaurant-serviceswitched fromcom.jayway.restassured→io.rest-assured. Confirm no existing test code in those modules relied on the old package (they should have had zero tests, but double-check).Field.setAccessible(true)to set entity IDs (e.g.,ConsumerControllerTest.setConsumerId,CourierControllerTest.setCourierId, domain tests settingOrder.id). Verify this works under Java 21's module access rules in CI.OrderTest,CourierTest) to verify state transition assertions are meaningful and not just trivially passing. TheCourierServiceTestuses manualmock()in@Beforewhile others use@RunWith(MockitoJUnitRunner.class)— minor inconsistency.Suggested test plan: Run
./gradlew :ftgo-domain:test :ftgo-consumer-service:test :ftgo-restaurant-service:test :ftgo-courier-service:test :ftgo-order-service:testlocally and verify all tests pass. Check that pre-existing tests (e.g.,CourierAssignmentStrategyTest,AddressTest) still pass with the forced dependency versions.Notes
java.lang.UnsupportedOperationException: Cannot define class using reflection).Link to Devin session: https://app.devin.ai/sessions/8d5dc462c316414393712dd16db9c1cb
Requested by: @bcmake