As per latest documentation of version 4.2.0 it looks like mockito community has come up with mockito-inline for some experimental features like mocking final classes and methods, mocking static methods etc. So once they get feedback from community they will merge those changes in mockito-core and abolished mockito-inline. Eventually it will be mockito-core only.

https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-inline https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#39

Answer from Prakash Boda on Stack Overflow
Top answer
1 of 3
55

As per latest documentation of version 4.2.0 it looks like mockito community has come up with mockito-inline for some experimental features like mocking final classes and methods, mocking static methods etc. So once they get feedback from community they will merge those changes in mockito-core and abolished mockito-inline. Eventually it will be mockito-core only.

https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-inline https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#39

2 of 3
19

As of Mockito 5.0.0, mockito-inline is the default mock maker:

This mockmaker [mockito-inline] creates mocks manipulating bytecode equivalent within the original class such that its method implementations hook into the normal Mockito machinery. As a comparison, the subclass mockmaker generates "real" subclasses for mocks, to mimic the same behavior. While the approaches are similar, the inline mockmaker avoids certain restrictions that the JDK imposes. For example, it does not violate module boundaries (introduced in JDK 9, but more heavily used in JDK 17) and avoids the leaking of the creation of the subclass.

mockito-inline was a separate, configuration-free artifact. (If you wanted to use inline mock making with mockito-core, you had to configure the MockMaker extension file.) However, since Mockito 5.3.0, mockito-inline is no longer published!

If you want to (or have to) use subclass mock making after 5.0.0, there is again a separate, configuration free artifact: mockito-subclass.

There are legitimate remaining use cases for the subclass mockmaker. For example, on the Graal VM's native image, the inline mockmaker will not work and the subclass mockmaker is the appropriate choice. Additionally, if you would like to avoid mocking final classes, using the subclass mockmaker is a possibibility. Note however that if you solely want to use the subclass mockmaker to avoid mocking final, you will run into the above mentioned issues on JDK 17+. We want to leave this choice up to our users, which is why we will keep on supporting the subclass mockmaker.

🌐
GitHub
github.com › mockito › mockito › issues › 2877
Mockito-inline dependency after upgrade 5.0.0 · Issue #2877 · mockito/mockito
January 18, 2023 - After reading that mockito switched to mockito-inline by default (with 5.0.0) i expected either mockito-core to have a mockito-inline dependency, or mockito-inline has been merged into mockito-core. Interestingly neither of this is the c...
Author   EugenMayer
🌐
Cloudsmith
cloudsmith.com › navigator › maven › org.mockito:mockito-inline
org.mockito:mockito-inline (5.2.0) - maven Package Quality | Cloudsmith Navigator
$mvn install org.mockito:mockito-inline · /Processing... ✓Done · Start your free trial · 5.2.0 · Stable version · 3years ago · Released · Loading Version Data · Maven on Cloudsmith · Learn more about Maven on Cloudsmith ·
🌐
GitHub
github.com › mockito › mockito › issues › 3621
Since mockito-inline has been removed, the exception messages with `mockito-inline` should be modified. · Issue #3621 · mockito/mockito
March 22, 2025 - These two functions ‎MockMaker::createStaticMock and MockMaker::createConstructionMock throw exceptions with message contains by placing the 'mockito-inline' artifact. We know that mockito-inline has been removed since v5.3.0. These mess...
Author   Starwalker2000
🌐
GitHub
github.com › mockito › mockito › releases
Releases · mockito/mockito
March 11, 2026 - Since mockito-inline has been removed, the exception messages with mockito-inline should be modified.
Author   mockito
🌐
GitHub
github.com › mockito › mockito
GitHub - mockito/mockito: Most popular Mocking framework for unit tests written in Java · GitHub
Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2. Mockito 4 removes deprecated API.
Starred by 15.4K users
Forked by 2.7K users
Languages   Java
🌐
Maven Repository
mvnrepository.com › artifact › org.mockito › mockito-inline
Maven Repository: org.mockito » mockito-inline
March 9, 2023 - Mockito preconfigured inline mock maker (intermediate and to be superseeded by automatic usage in a future version)
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 79604591 › how-to-mock-a-final-class-with-mockito-core-5-2-0-and-without-mockito-inline
java - How to mock a final class with mockito-core > 5.2.0 and without mockito-inline? - Stack Overflow
I have been searching the internet for this one for quite sometimes, and I can't find a definite answer. Mockito-inline is now deprecated, so I am trying to run my tests with only mockito-core > 5.2.0.
🌐
GitHub
github.com › mockito › mockito › blob › release › 3.x › doc › release-notes › official.md
mockito/doc/release-notes/official.md at release/3.x · mockito/mockito
Incompatibility between the inline mocks and JaCoCo 0.8.4 (#1717) Fixes #298: replaces Objenesis references from stubbing classes with plugin equivalents. (#1715) Fixes #1713: fix typo in Mockito.java javadoc (#1714)
Author   mockito
🌐
Maven Central
central.sonatype.com › artifact › org.mockito › mockito-inline
Maven Central: org.mockito:mockito-inline
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> <version>5.2.0</version> <name>mockito-inline</name> <description>Mockito preconfigured inline mock maker (intermediate and to be superseeded by automatic usage in a future version)</description> <url>https://github.com/mockito/mockito</url> <licens
🌐
GitHub
github.com › mockito › mockito › issues › 1083
Mockito 2 mock-maker-inline not able to mock Object methods on an interface · Issue #1083 · mockito/mockito
May 15, 2017 - Hi there, I recently upgraded from Mockito 1.9.5 to 2.7.22 (mockito-inline), and some tests started failed as Mockito is unable to mock Object.toString() method on an interface. It appears to be that the inline mock maker cannot mock Obj...
Published   May 15, 2017
Author   mina-asham
🌐
Maven Repository
mvnrepository.com › artifact › org.mockito › mockito-inline › 3.6.0 › usages
Maven Repository: org.mockito » mockito-inline » 3.6.0 - Used By
Mockito preconfigured inline mock ... token pattern to mitigate the risk of Cross-Site Request Forgery (CSRF) attacks. ... This library is deprecated, it was incorporated to Kogito Core....
🌐
Javadoc.io
javadoc.io › static › org.mockito › mockito-core › 3.2.4 › org › mockito › plugins › InlineMockMaker.html
InlineMockMaker (Mockito 3.2.4 API)
Extension to MockMaker for mock makers that changes inline method implementations and need keep track of created mock objects. Mockito's default inline mock maker keeps track of created mock objects via weak reference map. This poses a risk of memory leaks in certain scenarios (issue #1619).
🌐
Baeldung
baeldung.com › home › testing › warning: “the type mockitojunitrunner is deprecated”
Warning: “The type MockitoJUnitRunner is deprecated” | Baeldung
January 8, 2024 - While removing the warning is not mandatory, it’s recommended to do so. Mockito version 3 will remove this class. In this section we’ll explain three different solutions for resolving this deprecation warning:
🌐
Baeldung
baeldung.com › home › testing › difference between mockito core and mockito inline
Difference Between Mockito Core and Mockito Inline | Baeldung
September 17, 2024 - In the latest version of Mockito Core, Mockito Inline became the default mock maker since Mockito Core version 5.0.0.
🌐
GitHub
github.com › mockito › mockito › issues › 3328
Tests failures after adding mockito-inline on Java 21 · Issue #3328 · mockito/mockito
April 27, 2024 - Hi, It appears that Mockito cannot mock several classes after adding mockito-inline dependency to the project Mockito cannot mock this class: class org.apache.http.impl.client.CloseableHttpClient. If you're not sure why you're getting th...
Author   MikhailNavitski
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Understanding Mockito Core vs Mockito Inline - Java Code Geeks
October 22, 2024 - With version 5.0.0, Mockito introduced a major change by switching the default MockMaker interface to the one used by Mockito Inline, enabling support for mocking constructors, static methods, and final classes directly within Mockito Core itself.