# Mockito v5.21.0 - Product: Mockito (https://whatsnew.fyi/product/mockito) - Vendor: Mockito - Date: 2025-12-09 - Version: v5.21.0 - Original notes: https://github.com/mockito/mockito/releases/tag/v5.21.0 - Permalink: https://whatsnew.fyi/product/mockito/releases/v5.21.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- - **added** — Output matchers to potential mismatch messages - **added** — Automatically detect class to mock in mockStatic and mockConstruction - **added** — Return completed futures for unstubbed Future/CompletionStage in ReturnsEmptyValues - **added** — Support primitives in GenericArrayReturnType - **fixed** — StackOverflowError when mocking WeakReference - **fixed** — ClassNotFoundException when stubbing array of primitive type on Android - **removed** — Forbid mocking WeakReference with inline mock maker *Changelog generated by [Shipkit Changelog Gradle Plugin](https://github.com/shipkit/shipkit-changelog)* ###### 5.21.0 - 2025-12-09 - [17 commit(s)](https://github.com/mockito/mockito/compare/v5.20.0...v5.21.0) by Giulio Longfils, Joshua Selbo, Woongi9, Zylox, dependabot[bot] - Bump graalvm/setup-graalvm from 1.4.3 to 1.4.4 [(#3768)](https://github.com/mockito/mockito/pull/3768) - Bump graalvm/setup-graalvm from 1.4.2 to 1.4.3 [(#3767)](https://github.com/mockito/mockito/pull/3767) - Bump actions/checkout from 5 to 6 [(#3765)](https://github.com/mockito/mockito/pull/3765) - Adds output of matchers to potential mismatch; Fixes #2468 [(#3760)](https://github.com/mockito/mockito/pull/3760) - Forbid mocking WeakReference with inline mock maker [(#3759)](https://github.com/mockito/mockito/pull/3759) - StackOverflowError when mocking WeakReference [(#3758)](https://github.com/mockito/mockito/issues/3758) - Bump actions/upload-artifact from 4 to 5 [(#3756)](https://github.com/mockito/mockito/pull/3756) - Bump graalvm/setup-graalvm from 1.4.1 to 1.4.2 [(#3755)](https://github.com/mockito/mockito/pull/3755) - Support primitives in GenericArrayReturnType. [(#3753)](https://github.com/mockito/mockito/pull/3753) - ClassNotFoundException when stubbing array of primitive type on Android [(#3752)](https://github.com/mockito/mockito/issues/3752) - Bump graalvm/setup-graalvm from 1.4.0 to 1.4.1 [(#3744)](https://github.com/mockito/mockito/pull/3744) - Bump gradle/actions from 4 to 5 [(#3743)](https://github.com/mockito/mockito/pull/3743) - Bump org.graalvm.buildtools.native from 0.11.0 to 0.11.1 [(#3738)](https://github.com/mockito/mockito/pull/3738) - Bump com.diffplug.spotless:spotless-plugin-gradle from 7.2.1 to 8.0.0 [(#3735)](https://github.com/mockito/mockito/pull/3735) - Bump graalvm/setup-graalvm from 1.3.7 to 1.4.0 [(#3734)](https://github.com/mockito/mockito/pull/3734) - Bump org.assertj:assertj-core from 3.27.5 to 3.27.6 [(#3733)](https://github.com/mockito/mockito/pull/3733) - Bump errorprone from 2.41.0 to 2.42.0 [(#3732)](https://github.com/mockito/mockito/pull/3732) - Feat: automatically detect class to mock in mockStatic and mockConstruction [(#3731)](https://github.com/mockito/mockito/pull/3731) - Return completed futures for unstubbed Future/CompletionStage in ReturnsEmptyValues [(#3727)](https://github.com/mockito/mockito/pull/3727) - automatically detect class to mock [(#2779)](https://github.com/mockito/mockito/pull/2779) - Incorrect "has following stubbing(s) with different arguments" message when using Argument Matchers [(#2468)](https://github.com/mockito/mockito/issues/2468)