diff --git a/src/main/java/org/mockito/Mockito.java b/src/main/java/org/mockito/Mockito.java index 9d20b43bae..336251e0ae 100644 --- a/src/main/java/org/mockito/Mockito.java +++ b/src/main/java/org/mockito/Mockito.java @@ -2461,6 +2461,17 @@ public static void reset(T... mocks) { MOCKITO_CORE.reset(mocks); } + /** + * Clears all mocks, type caches and instrumentations. + *

+ * By clearing Mockito's state, previously created mocks might begin to malfunction. This option can be used if + * Mockito's caches take up too much space or if the inline mock maker's instrumentation is causing performance + * issues in code where mocks are no longer used. Normally, you would not need to use this option. + */ + public static void clearAllCaches() { + MOCKITO_CORE.clearAllCaches(); + } + /** * Use this method in order to only clear invocations, when stubbing is non-trivial. Use-cases can be: *