Learnt Lessons from Mockito 2.x Migration
summary
Migration from Mockito 1.x to 2.x hits real pain: a large app with thousands of tests sees 50% of tests fail after upgrading, thanks to changed matchers, removed white‑box support, and PowerMock incompatibilities. Practical fixes include enabling mock-maker-inline via test resources, iterating PowerMock versions until a compatible build is found, and replacing static calls with a rubber proxy pattern. Demos show removal of PowerMock, concrete Gradle tweaks, and cleaner tests that actually run.
AI-written summary · about
chapters (10)
- 0:00Start
- 4:05Wizard Fragment
- 4:35Weather Presenter
- 5:30Wizard Presenter
- 15:07Mocking the Dependencies
- 20:27Illegal Access Exceptions
- 24:19Esthetic Methods
- 24:45Rubber Proxy Pattern
- 29:35Demo
- 31:18Inline Mocking
related talks
40mMockito 2 - Powrót Króla
31mGreat tools for engineers: even cleaner tests with Mockito 2
31mBeyond the Mockery- Why We Should Embrace Testing Without Mocking Frameworks
18mCommon pitfalls in mobile testing
27mDe-mock your tests
59mJava Testing Part 2: Mocks, Stubs, and Spies with Mockito 4
38mDoublers in Tests. Wiremock vs Mockito
41mMocks vs Fakes vs Stubs
