fix: enforce exception assertion in HeartbeatListenerTest (#6594) - #6947
Open
yykaue wants to merge 2 commits into
Open
fix: enforce exception assertion in HeartbeatListenerTest (#6594)#6947yykaue wants to merge 2 commits into
yykaue wants to merge 2 commits into
Conversation
Aias00
approved these changes
Aug 22, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
PR #6947 Review — fix: enforce exception assertion in HeartbeatListenerTest (#6594)
Verdict: APPROVE
Scope
shenyu-register-client-beat HeartbeatListenerTest#testSendHeartbeatWithLoginFailure: replace
a catch-block-only assertion with assertThrows.
Verification
- Old code wrapped
sendHeartbeatMethod.invoke(...)in try/catch and only asserted inside catch,
so the test could pass vacuously when no exception was thrown. New code uses
assertThrows(InvocationTargetException.class, ...)then
assertInstanceOf(RuntimeException.class, exception.getCause()), enforcing that the failure
actually occurs and has the right cause. - Imports
java.lang.reflect.InvocationTargetException,assertInstanceOf,assertThrowsadded
and used; no production code touched.
Notes
- Pure test-strengthening change; reduces false-green risk. Approving.
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 is this PR for?
Fixes #6594.
This PR replaces the catch-block-only assertion in
HeartbeatListenerTest#testSendHeartbeatWithLoginFailurewithassertThrows.The test now:
Method.invoketo throw anInvocationTargetException.RuntimeException.Verification
HeartbeatListenerTest: 8 tests passed.@Aias00 Could you please help review this PR? Thank you!