Below are the main advantages or benefits of Mockito:
- Annotation Support: It supports creating mocks using various annotations.
- No Handwriting: We do not need to write mock objects by own.
- Return value support: Supports return values.
- Exception support: It supports exceptions.
- Order check support: It also supports check on the order of method calls.
- Refactoring Safe: Even if we rename an interface method names or reordering parameters will not break the test code as Mocks are created at run time.
You May Also Like:
What is Mocking?
Why Need for mocking?
How to mock interface using Mockito example?
Mockito and JUnit Integration Using Maven Example
@Mock and @Spy Mockito Annotations With Example
@InjectMocks Annotation in Mockito with Example
Mockito – Verifying Method Calls
@Captor Annotation in Mockito with Example
Adding behavior to mocked object in Mockito
Mocking Void Methods with Mockito
Mocking Exception Throwing using Mockito
Mockito’s mock Overloaded Methods
That’s all about What are the Benefits of Mockito?
If you have any feedback or suggestion please feel free to drop in below comment box.