Skip to content

Commit e2a5277

Browse files
author
Ted Sander
committed
Fix bug where deep matcher expects a map passed into the matches function
1 parent 64a81ac commit e2a5277

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/mockito.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class InvocationMatcher {
148148

149149
bool isMatchingArg(roleArg, actArg) {
150150
if(roleArg is _ArgMatcher){
151-
return roleArg._matcher==null || roleArg._matcher.matches(actArg, null);
151+
return roleArg._matcher==null || roleArg._matcher.matches(actArg, {});
152152
// } else if(roleArg is Mock){
153153
// return identical(roleArg, actArg);
154154
}else{

test/mockitoSpec.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ main(){
142142
when(mock.methodWithoutArgs()).thenReturn("B");
143143
expect(mock.methodWithoutArgs(), equals("B"));
144144
});
145+
test("should mock method with calculated result", (){
146+
when(mock.methodWithNormalArgs(argThat(equals(43)))).thenReturn("43");
147+
when(mock.methodWithNormalArgs(argThat(equals(42)))).thenReturn("42");
148+
expect(mock.methodWithNormalArgs(43), equals("43"));
149+
});
145150

146151
});
147152

0 commit comments

Comments
 (0)