Please upgrade Mockito to v2
Branch: "todo-mvp"
I notice we're still using Mockito v1.10.19 while the v2 was released since Oct 2016. Should we upgrade Mockito as well as the tests to latest version (v2.25.0)?
Yes, upgrading Mockito to v2 (or even v3/4 if compatible) is a good idea—especially for projects like todo-mvp, where maintaining compatibility with modern tooling and syntax is important.
Why upgrade to Mockito v2+? Improved syntax (MockitoAnnotations.initMocks(this) → @Mock + MockitoJUnitRunner)
Better Java 8+ support
Support for final classes & methods (with inline mocking)
Improved performance and error messages
More active maintenance and bug fixes
How to upgrade Mockito in todo-mvp
- Update the dependency In build.gradle (module-level):
testImplementation 'org.mockito:mockito-core:2.25.0' Or latest stable:
testImplementation 'org.mockito:mockito-core:4.11.0' // adjust as needed Optional: Add inline mocking support (for final classes, static methods, etc.)
testImplementation 'org.mockito:mockito-inline:4.11.0' 2. Update test syntax If your tests use old Mockito syntax (v1), you may need to migrate:
Example changes:
// Old way (Mockito 1.x) MockitoAnnotations.initMocks(this);
// New way (Mockito 2+) @ExtendWith(MockitoExtension.class) // if using JUnit 5 Or for JUnit 4:
@RunWith(MockitoJUnitRunner.class)