diff --git a/src/main/java/org/mockito/ArgumentCaptor.java b/src/main/java/org/mockito/ArgumentCaptor.java index e9b347bd2e..2fdeb628d7 100644 --- a/src/main/java/org/mockito/ArgumentCaptor.java +++ b/src/main/java/org/mockito/ArgumentCaptor.java @@ -50,8 +50,7 @@ * Custom argument matchers via {@link ArgumentMatcher} are usually better for stubbing. * *
- * This utility class *doesn't do any type checks*. The generic signatures are only there to avoid casting - * in your code. + * This utility class will perform type checking on the generic type (since Mockito 5.0.0). *
* There is an annotation that you might find useful: @{@link Captor} *
@@ -68,7 +67,7 @@ public class ArgumentCaptor
- * Note that an ArgumentCaptor
.
* ArgumentCaptor
*doesn't do any type checks*. It is only there to avoid casting
- * in your code. This might however change (type checks could be added) in a
- * future major release.
+ * An ArgumentCaptor
will perform type checks (since Mockito 5.0.0).
*
* @param clazz Type matching the parameter to be captured.
* @param Type of clazz
@@ -148,6 +145,6 @@ public List clazz) {
- return new ArgumentCaptor(clazz);
+ return new ArgumentCaptor<>(clazz);
}
}