Remove Mockito: replace mock-based tests with fakes and FakeWsmanServer - #132
Merged
bertysentry merged 1 commit intoJul 27, 2026
Merged
Conversation
…t FakeWsmanServer
The last three Mockito test files were forced into mockStatic by static factory
methods. They now run the real stack instead: WinRMWqlExecutor and
WinRMCommandExecutor go through WinRMExecutorFactory -> LightWinRMService ->
WsmanClient -> FakeWsmanServer (genuine NTLMv2 handshake and message
encryption), and the CLI code-page test scripts the CodeSet query on the fake
server rather than mocking the charset lookup.
FakeWsmanServer is now public and the canned SOAP response bodies are shared in
the new FakeWsmanResponses helper, also used by WsmanProtocolTest.
mockito-inline 5.2.0 (deprecated, incompatible with recent JDKs) leaves the
dependency tree along with byte-buddy and objenesis. maven-pmd-plugin (3.28.0,
PMD 7.17.0) and spotbugs-maven-plugin (4.10.3.0) are upgraded because the
previous versions crashed on the JDK 25 class library ("Unsupported class file
major version 69"); gate and site report stay on the same versions.
mvn clean verify site is green on JDK 17 and JDK 25: the JDK pin for local
builds is gone.
Closes #119
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bertysentry
deleted the
119-remove-mockito-replace-mock-based-tests-with-fakes
branch
July 27, 2026 16:19
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.
Closes #119.
What
Removes
org.mockito:mockito-inline(deprecated, breaks on recent JDKs) and rewrites the last three mock-based test files as end-to-end tests against the in-processFakeWsmanServer.Test rewrites
WinRMWqlExecutorTestmockStatic(WinRMExecutorFactory)+ interface mockexecuteWql→ factory →LightWinRMService→WsmanClient→FakeWsmanServer, real NTLMv2 handshake and message encryption; also pins the query sent on the wireWinRMCommandExecutorTestmockStatic+ScriptedWindowsRemoteExecutorbehind a mocked factoryCMD.EXE /C (...)with the content-addressed remote name)WinRmCliTest.decodesCommandOutputUsingTheRemoteWindowsCodePagemock(LightWinRMService)+mockStatic(WindowsRemoteProcessUtils)Test infrastructure
FakeWsmanServeris now public (usable from thewql,command, andclitest packages).FakeWsmanResponseshelper: the canned SOAP response bodies (enumeration results, shell lifecycle, faults) and whole-exchange enqueue helpers, shared withWsmanProtocolTest(whose private duplicates are gone).JDK 25 build support (acceptance criterion of #119)
With Mockito gone, the remaining JDK 25 blockers were the quality tools crashing on the JDK 25 class library ("Unsupported class file major version 69"):
maven-pmd-plugin3.26.0 → 3.28.0 (PMD 7.7.0 → 7.17.0). PMD 7.7.0's failed type resolution also produced a false-positiveUnusedPrivateMethodonLightWinRMService.executeWithTimeout.spotbugs-maven-plugin4.9.3.0 → 4.10.3.0, gate and site report pinned to the same version.Verification
mvn clean verify sitegreen on JDK 17 (CI) and JDK 25 (default): 83 tests, 0 checkstyle/PMD/CPD/SpotBugs findings — the JDK pin for local builds can be dropped.mvn dependency:tree: nomockito,byte-buddy, orobjenesis; test scope is JUnit only.org.mockitoimport remains anywhere in the repository.🤖 Generated with Claude Code