test: increase line coverage to 97% with unit and integration tests#211
Merged
Conversation
Adds 93 tests (60 unit via surefire, 33 integration via failsafe) covering
all production business logic that was previously untested.
New test classes:
- RestClientIT: HTTP behavior (GET/POST/DELETE, status codes, empty body)
- AemManagementClientIT: SEMP v2 logic (queue idempotency, subscriptions, URL encoding)
- AemValidationClientIT: handshake payload construction and host extraction
- AemMessagingServiceTest: skipManagement guards, DMQ pre-creation, topic prefix,
validate one-shot guard, getMessageTopic for all message types, stop lifecycle
- AemValidationOAuth2PropertySupplierTest: credential extraction, URI validation
- AemMessagingConnectionProviderTest: bearer token extraction edge cases
- Extended AemMessagingServiceConfigurationTest: kind-based config paths
Production changes (test seams only, no behaviour change):
- RestClient: package-private constructor accepting HttpDestination; fix empty
response body returning {} instead of throwing MismatchedInputException
- AemManagementClient, AemValidationClient: package-private test constructors
- AemMessagingService: package-private test constructor; extract AemValidationClient
to field instead of constructing inline in validate()
- AemMessagingConnectionProvider: package-private test constructor; expose
fetchToken/getToken as package-private
Build: failsafe plugin added; surefire excludes *IT.java; JaCoCo wired for
integration test coverage via prepare-agent-integration/report-integration.
Contributor
SummaryThe following content is AI-generated and provides a summary of the pull request: Increase Line Coverage to 97% with Unit and Integration TestsNew Features🧪 Test: Added 93 tests (60 unit / 33 integration) raising line coverage from ~3 covered classes to 97% overall. Integration tests use MockServer and run via Changes
PR Bot InformationVersion:
|
Contributor
There was a problem hiding this comment.
The PR adds a solid test suite with good coverage. The main issues found are:
- Misleading test (
testKindBasedConfigIsIgnoredWhenMultipleBindingsPresent) — the test name claims multi-binding isolation is tested, but the assertion actually verifies the opposite (single-binding positive case); this test does not prove the stated behaviour. - Missing pre-condition assertions in
AemValidationClientIT— two tests accessrecorded[0]without first assertingrecorded.length == 1, risking misleadingArrayIndexOutOfBoundsExceptionfailures. - Incomplete test assertion in
AemMessagingServiceTest—emitTopicMessage_triggers_validate_on_first_callverifiesvalidatewas called but not that the broker'semitTopicMessagewas also invoked. - Duplicated property-parsing logic across both
AemMessagingServiceconstructors — should be extracted to a shared private helper to avoid divergence. - Inconsistent plugin version management —
maven-failsafe-pluginhardcodes version3.5.6whilemaven-surefire-pluginrelies on the parent BOM, risking version drift between the two tightly-coupled plugins.
PR Bot Information
Version: 1.22.5
- Event Trigger:
pull_request.opened - File Content Strategy: Full file content
- LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
f8d25c77-5e86-4a7d-b2fe-b6c7dbcbf88c
- Remove misleading test that claimed multi-binding isolation but only exercised single-binding positive case (already covered elsewhere). - Add recorded.length assertions before recorded[0] access in AemValidationClientIT to avoid misleading AIOOBE failures. - Verify broker.emitTopicMessage invocation in emitTopicMessage_triggers_validate_on_first_call. - Extract duplicated connection-property parsing in AemMessagingService to a shared applyConnectionProperties helper. - Move maven-failsafe-plugin version into parent pluginManagement so it stays aligned with maven-surefire-plugin.
- Pin byte-buddy-agent as an explicit test dependency and pass it via -javaagent in surefire/failsafe argLine so Mockito no longer self-attaches at runtime (preparing for future JDKs that disallow dynamic agent loading). - Add a minimal log4j.properties under src/test/resources to provide a console appender for slf4j-reload4j, removing the "No appenders could be found" warnings.
BraunMatthias
approved these changes
Jun 30, 2026
dimamost
approved these changes
Jul 1, 2026
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
maven-failsafe-plugin(*IT.java); pure Mockito tests remain unit tests via surefire (*Test.java)RestClient.handleJsonResponse: empty response body no longer throwsMismatchedInputException— returns{}insteadNew test classes
RestClientITAemManagementClientITAemValidationClientITAemMessagingServiceTestskipManagementguards, DMQ pre-creation,emitTopicMessageprefix, validate one-shot guard,getMessageTopic(text/bytes/unknown),stoplifecycleAemValidationOAuth2PropertySupplierTestisOAuth2Binding, URI validation,CredentialsViewextractionAemMessagingConnectionProviderTestAemMessagingServiceConfigurationTestkind: aemandkind: advanced-event-meshconfig pathsProduction changes (test seams only — no behaviour change)
RestClient: package-private constructor acceptingHttpDestination; empty body fixAemManagementClient,AemValidationClient: package-private test constructorsAemMessagingService: package-private test constructor;AemValidationClientextracted to field instead of constructed inline invalidate()AemMessagingConnectionProvider: package-private test constructor;fetchToken/getTokenmade package-privateTest plan
mvn clean verifypasses (60 unit + 33 integration, 0 failures)*ITclasses appear in failsafe output; no*ITin surefire output