Skip to content

Instantly share code, notes, and snippets.

@vicly
Created March 17, 2019 23:09
Show Gist options
  • Select an option

  • Save vicly/42e4631cbe1026b5002474e916b1e498 to your computer and use it in GitHub Desktop.

Select an option

Save vicly/42e4631cbe1026b5002474e916b1e498 to your computer and use it in GitHub Desktop.
[Mockito mock final class/method] #Test

Use Mockito V2, V1 does not support mocking final/static.

<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-core</artifactId>
  <version>2.25.1</version>
</dependency>

Create file src/resources/mockito-extensions/org.mockito.plugins.MockMaker with single line:

mock-maker-inline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment