diff --git a/src/main/java/org/mockito/Mockito.java b/src/main/java/org/mockito/Mockito.java index b96009b0ec..9f8b860c1c 100644 --- a/src/main/java/org/mockito/Mockito.java +++ b/src/main/java/org/mockito/Mockito.java @@ -103,6 +103,7 @@ * 48. New API for mocking static methods (Since 3.4.0)
* 49. New API for mocking object construction (Since 3.5.0)
* 50. Avoiding code generation when restricting mocks to interfaces (Since 3.12.2)
+ * 51. New API for marking classes as unmockable (Since 4.1.0)
* * *

0. Migrating to Mockito 2

@@ -1594,6 +1595,15 @@ * This mock maker can be activated explicitly by the mockito extension mechanism, just create in the classpath a file * /mockito-extensions/org.mockito.plugins.MockMaker containing the value mock-maker-proxy. * + *

51. Mark classes as unmockable (since 4.1.0)

+ * + * In some cases, mocking a class/interface can lead to unexpected runtime behavior. For example, mocking a java.util.List + * is difficult, given the requirements imposed by the interface. This means that on runtime, depending on what methods the application + * calls on the list, your mock might behave in such a way that it violates the interface. + * + *

+ * For any class/interface you own that is problematic to mock, you can now mark the class with {@link org.mockito.DoNotMock @DoNotMock}. For usage + * of the annotation and how to ship your own (to avoid a compile time dependency on a test artifact), please see its JavaDoc. *

*/ @CheckReturnValue