[#00] refactor backend test DI style and align Quartz job wiring#157
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates query-service tests to match recent DI/wiring changes, resolving test compilation issues caused by mismatched construction patterns for Spring-managed components.
Changes:
- Updated
IntegrityCheckIntegrationTestto use constructor-based injection via@TestConstructor. - Updated
ReconciliationQuartzJobTestto construct the Quartz job via no-args constructor and inject dependencies throughsetDependencies(...).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/query-service/src/test/java/lt/satsyuk/distributed/audit/query/jobs/ReconciliationQuartzJobTest.java | Aligns test job creation with the job’s no-args + setter-based dependency wiring. |
| backend/query-service/src/test/java/lt/satsyuk/distributed/audit/query/integration/IntegrityCheckIntegrationTest.java | Migrates from field injection to constructor injection for JwtService and DatabaseClient in the integration test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What changed
@Autowiredprivate-field injection with constructor injection in backend test classes acrosscommand-service,event-store-service,audit-writer-service, andquery-service.@TestConstructor(autowireMode = TestConstructor.AutowireMode.ALL)where tests now rely on constructor-based test dependency injection.ReconciliationQuartzJobto a Quartz-safe setter-only injection path (no-argsconstructor +@Autowired setDependencies(...)).ReconciliationQuartzJobTestto instantiate the job with no-args constructor and wire collaborators throughsetDependencies(...).IntegrityCheckIntegrationTestwith constructor-based test injection style.Files in scope
backend/audit-writer-service/src/test/java/lt/satsyuk/distributed/audit/auditwriter/consumer/AuditEventConsumerKafkaTestcontainersTest.javabackend/command-service/src/test/java/lt/satsyuk/distributed/audit/command/api/AuthControllerWebFluxTest.javabackend/command-service/src/test/java/lt/satsyuk/distributed/audit/command/api/CommandControllerWebFluxValidationTest.javabackend/command-service/src/test/java/lt/satsyuk/distributed/audit/command/config/KafkaProducerConfigIntegrationTest.javabackend/command-service/src/test/java/lt/satsyuk/distributed/audit/command/service/UserLoginCommandServiceKafkaIntegrationTest.javabackend/event-store-service/src/test/java/lt/satsyuk/distributed/audit/eventstore/EventStoreKafkaToPostgresIntegrationTest.javabackend/query-service/src/main/java/lt/satsyuk/distributed/audit/query/jobs/ReconciliationQuartzJob.javabackend/query-service/src/test/java/lt/satsyuk/distributed/audit/query/integration/IntegrityCheckIntegrationTest.javabackend/query-service/src/test/java/lt/satsyuk/distributed/audit/query/jobs/ReconciliationQuartzJobTest.javaWhy
ReconciliationQuartzJob.Verification
mvn testpasses locally.mvn verifypasses locally.