Goal
Remove Mockito (org.mockito:mockito-inline:5.2.0, test scope) from the project and replace the remaining mock-based tests with hand-rolled fakes and end-to-end tests against the existing FakeWsmanServer.
Why
- JDK 25 incompatibility: Mockito''s inline mock maker (byte-buddy agent) breaks on recent JDKs; today the project must be built with JDK 17 solely because of the Mockito-based tests.
- Deprecated artifact:
mockito-inline was merged into mockito-core in Mockito 5.3 — the current dependency is a dead end regardless.
- Testing style: 13 of 17 test files already test without mocks, using
FakeWsmanServer (an in-process WSMan fake speaking genuine NTLMv2) or plain fakes. The 4 Mockito files are leftovers, all forced into mockStatic by static factory methods (WinRMExecutorFactory.createInstance, SmbTempShare.createInstance, WindowsRemoteProcessUtils.getWindowsEncodingCharset).
Plan (file by file)
| Test file |
Mockito usage |
Replacement |
SmbTempShareTest |
4x mockStatic + mocks of smbj Connection/Session/DiskShare |
Deleted by #117 — the replacement file-copy tests run against FakeWsmanServer or a hand-rolled WindowsRemoteExecutor fake |
WinRMWqlExecutorTest |
mockStatic(WinRMExecutorFactory) + interface mock |
Rewrite end-to-end against FakeWsmanServer (factory -> LightWinRMService -> WsmanClient -> fake server); also covers factory wiring |
WinRMCommandExecutorTest |
3x mockStatic + interface mocks |
No-copy path: end-to-end against FakeWsmanServer. File-copy path: after #117, also through the fake server |
WinRmCliTest |
1 test (decodesCommandOutputUsingTheRemoteWindowsCodePage) uses mock/mockStatic; the rest already uses a hand-rolled FakeRemote |
Small injectable seam for the charset lookup, or script the codepage query on FakeWsmanServer |
Sequencing
Blocked by #117 (remove smbj): doing this first would mean reworking the SMB mocks for nothing, since SmbTempShareTest and the file-copy path of WinRMCommandExecutorTest are rewritten there anyway.
Acceptance criteria
- No
org.mockito dependency in pom.xml; mockito-inline, byte-buddy, byte-buddy-agent, and objenesis gone from mvn dependency:tree.
- No
org.mockito import anywhere in src/test.
mvn verify green on JDK 17 and the current default JDK (25) — the JDK pin for builds can be dropped.
- Test coverage of the converted tests is equal or better (the
FakeWsmanServer end-to-end versions additionally verify factory wiring and real NTLM framing).
Goal
Remove Mockito (
org.mockito:mockito-inline:5.2.0, test scope) from the project and replace the remaining mock-based tests with hand-rolled fakes and end-to-end tests against the existingFakeWsmanServer.Why
mockito-inlinewas merged intomockito-corein Mockito 5.3 — the current dependency is a dead end regardless.FakeWsmanServer(an in-process WSMan fake speaking genuine NTLMv2) or plain fakes. The 4 Mockito files are leftovers, all forced intomockStaticby static factory methods (WinRMExecutorFactory.createInstance,SmbTempShare.createInstance,WindowsRemoteProcessUtils.getWindowsEncodingCharset).Plan (file by file)
SmbTempShareTestmockStatic+ mocks of smbjConnection/Session/DiskShareFakeWsmanServeror a hand-rolledWindowsRemoteExecutorfakeWinRMWqlExecutorTestmockStatic(WinRMExecutorFactory)+ interface mockFakeWsmanServer(factory ->LightWinRMService->WsmanClient-> fake server); also covers factory wiringWinRMCommandExecutorTestmockStatic+ interface mocksFakeWsmanServer. File-copy path: after #117, also through the fake serverWinRmCliTestdecodesCommandOutputUsingTheRemoteWindowsCodePage) usesmock/mockStatic; the rest already uses a hand-rolledFakeRemoteFakeWsmanServerSequencing
Blocked by #117 (remove smbj): doing this first would mean reworking the SMB mocks for nothing, since
SmbTempShareTestand the file-copy path ofWinRMCommandExecutorTestare rewritten there anyway.Acceptance criteria
org.mockitodependency inpom.xml;mockito-inline,byte-buddy,byte-buddy-agent, andobjenesisgone frommvn dependency:tree.org.mockitoimport anywhere insrc/test.mvn verifygreen on JDK 17 and the current default JDK (25) — the JDK pin for builds can be dropped.FakeWsmanServerend-to-end versions additionally verify factory wiring and real NTLM framing).