@Inherited @Retention(value=RUNTIME) @Target(value={FIELD,PARAMETER}) public @interface Capturing
maxInstances() attribute allows an upper limit to the number of future instances to be specified.
If multiple capturing mock fields/parameters of the same type are declared, this attribute can be used so that each
distinct instance gets associated with a separate mock field/parameter.
In turn, this allows different expectations to be recorded and/or verified for each grouping of future instances,
with each expectation using a different mock field/parameter.| Modifier and Type | Optional Element and Description |
|---|---|
int |
maxInstances
This attribute specifies the maximum number of new instances to be covered by the capturing mock field/parameter.
|
public abstract int maxInstances
maxInstances for each one of them, say n1, n2, etc.
In this case, the first n1 new instances will be associated with the first field/parameter, the following
n2 new instances to the second, and so on.