Javadocs in Mockito says - "Starting with version 2.7.6, we offer the 'mockito-inline' artifact that enables inline mock making without configuring the MockMaker extension file". What does this mean? How does mockito-inline works ? Why a separate artifact for mockito-inline?
What is mockito-inline and how does it work to mock final methods?
Asked Answered
I stumbled upon this too and the answer is buried quite deep in the docs, so here it is.
Mockito optionally offers advanced mocking features like mocking final classes. For this to work, they use a different mechanism ("mock maker") that is considered experimental and therefore turned off by default. But:
As a convenience, the Mockito team provides an artifact where this mock maker is preconfigured. Instead of using the mockito-core artifact, include the mockito-inline artifact in your project.
Since v5 Mockito uses mokito-inline by default: Mockito 5 switches the default mockmaker to mockito-inline, and now requires Java 11. –
Washout
© 2022 - 2024 — McMap. All rights reserved.