Issue #84: Fixed Junit tests for WinRMCommandExecutor and WinRMInvocationHandler - #83
Merged
Conversation
3 tasks
CherfaElyes
approved these changes
May 19, 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.
This pull request refactors and improves the unit tests for the WinRM client, primarily focusing on the
WinRMInvocationHandlerTestclass. The changes standardize how method invocations are mocked and verified, specifically by replacing the use of a generic mockedMethodobject with the actualreceivemethod fromWinRMWebService. This leads to more realistic and maintainable tests. Additionally, the changes improve clarity and robustness of exception handling in tests.Key changes include:
Test Refactoring and Standardization
Methodobject with the actualreceivemethod fromWinRMWebServicefor more accurate and meaningful unit tests. Test arguments now use realistic instances matching thereceivemethod signature. (WinRMInvocationHandlerTest.java) [1] [2]receivemethod and its arguments instead of the genericMETHODandARGS. This includes updating alldoReturn,doThrow,assertEquals,assertThrows, andverifycalls accordingly. (WinRMInvocationHandlerTest.java) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Helper and Utility Improvements
verifyReceiveInvoked(int times)to simplify and standardize verification ofreceivemethod invocations across tests. (WinRMInvocationHandlerTest.java)Exception Handling and Assertions
assertTrue(...startsWith(...))for greater robustness against message changes, instead of exact matches. (WinRMInvocationHandlerTest.java) [1] [2]Test Cleanup
@BeforeEachsetup for the mockedMethod, as it is no longer needed. (WinRMInvocationHandlerTest.java) [1] [2] [3]Minor Test Adjustments
WinRMInvocationHandlerTest.java,WinRMCommandExecutorTest.java) [1] [2] [3] [4]These changes make the tests more maintainable and realistic by using actual method signatures and arguments, and improve the clarity and reliability of test outcomes.