File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,20 @@ For generic arrays, use the `anyArray()` method:
65
65
verify(myClass).setItems(anyArray())
66
66
```
67
67
68
+ ## Custom instance creators
69
+
70
+ There are some cases where Mockito-Kotlin cannot create an instance of a class.
71
+ This can for instance be when a constructor has some specific preconditions
72
+ for its parameters.
73
+ You can _ register_ ` instance creators ` to overcome this:
74
+
75
+ ``` kotlin
76
+ MockitoKotlin .registerInstanceCreator<MyClass > { MyClass (5 ) }
77
+ ```
78
+
79
+ Whenever MockitoKotlin needs to create an instance of ` MyClass ` , this function is called,
80
+ giving you ultimate control over how these instances are created.
81
+
68
82
### Argument Matchers
69
83
70
84
Using higher-order functions, you can write very clear expectations about expected values.
You can’t perform that action at this time.
0 commit comments