← All Libraries
Mockito

Mockito

Tasty mocking framework for unit tests in Java.

Language: JavaCategory: TestingFirst released: 2007Created by: Szczepan FaberLicense: MIT

Mockito is a popular mocking framework for Java that allows you to create and configure mock objects for unit testing. It uses a clean, readable API with natural-language syntax (when/thenReturn, verify) and does not require expect-run-verify setup. Mockito makes it easy to isolate the code under test by replacing its dependencies with mock implementations.

Links

Key Features

Clean, readable mocking API (when/thenReturn)No expect-run-verify boilerplatePartial mocking with spies on real objectsArgument matchers for flexible stubbingVerification of invocation count and orderMock injection via annotations (@Mock, @InjectMocks)Answers for smart defaults and stubbingExtensible with custom answers and plugins