I am trying to verify if my method is called with the arguments I am interested in. However, it seems to be working only with primitive types. Instead of returning my object, it just says Instance of MyAnswer
. Why does this happen?
test('Compute answers', () async {
when(myService.submitAnswer(any, any)).thenAnswer((_) async {});
final model = MyModel();
model.submit(); // This calls myService.submitAnswer(MyAnswer(...), 123)).
verify(myService.submitAnswer(MyAnswer(...), 123).called(1);
});
This throws No matching calls. All calls: MyService.submitAnswer(Instance of 'MyAnswer', 123)
.
Aucun commentaire:
Enregistrer un commentaire