Mockito is used to create and configure mocked objects (e.g., a mock or spy) when unit testing.