0

I would like to create a matcher that takes async or non-async callback, sets up some listeners, invokes callback, verifies listeners received expected events, and then clean up listeners.

However, I see couple blockers:

  1. The method Matcher.matches is sync
  2. It seems expectLater is taking result of invocation, so matcher cannot configure listeners

Is it possible at all to create what I want?

polina-c
  • 6,245
  • 5
  • 25
  • 36
  • You can utilize the expectAsync function along with expectLater to handle asynchronous events in a custom matcher. – Dinesh Kumar M Aug 31 '23 at 18:16
  • How it will help me to set prerequisites, then invoke async callback, then verify results in sync Matcher.matches? Should I just use 'then' without awaiting in case of async method? – polina-c Aug 31 '23 at 23:33
  • 'then' will not work, because I need to return bool result from `matches`, that depends on result of execution. – polina-c Sep 01 '23 at 04:49

0 Answers0