Allow mocking of static methods
- Dominant language
- Java
- Stars
- 2k
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
@mockitoguy, @drewhannay
The Android API uses static methods, e.g. in Settings.Global . Some tests might want to mock those.
In https://github.com/mockito/mockito/issues/1013 there is a discussion for adding that to mockito. Unfortunately it might take some time to get this into mockito as we need
- a (non-Android) JVM implementation
- Agree on and API and get it approved
Hence I am proposing to prototype this as a variant of dexmaker-mockito-inline. Once this has proved useful we can upstream it to mockito.
I propose the following agena:
1. Add a new sub-project dexmaker-mockito-inline-extended. [Prototype](https://github.com/linkedin/dexmaker/compare/master...moltmann:staticMock?expand=1)
2. Wrap the Mockito class and add static mocking. [Proposal by @mockitoguy](https://github.com/mockito/mockito/issues/1013#issuecomment-291045005), [Full java-doc of Proposal](https://moltmann.github.io/dexmaker/)
3. The new APIs need to be clearly marked as "unstable"
4. Ship this extended mockito and get feedback
5. Work with mockito to upstream the new APIs
Contributor guide
Research direction
Start by reviewing the proposed dexmaker-mockito-inline-extended sub-project and the prototype comparison linked in the issue. Read Mockito issue #1013 and its API proposal, then define the unstable wrapper API and validate it with Android static-method mocking examples. Done means the extended variant is shipped for feedback and its APIs are clearly marked unstable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100