Closed soucolline closed 3 years ago
Hey, @soucolline. It seems like verifyNoMoreInteractions
has been implemented using a single generic parameter, I suppose to allow for multiple instances of the same type to be verified at once.
To verify instances of different classes at once, you have 2 options:
Call verifyNoMoreInteractions
for each type individually.
verifyNoMoreInteractions(mockLoginView)
verifyNoMoreInteractions(mockLoginUser)
Define helper functions (this could also get included in Cuckoo)
// For 2 different types:
// For 3 types just add M3 and another parameter and `verifyNoMoreInteractions` method call in the function.
// For 4 types M4 is needed and so on.
func verifyNoMoreInteractions<M1: Mock, M2: Mock>(_ mock1: M1, _ mock2: M2, file: StaticString = #file, line: UInt = #line) {
mock1.cuckoo_manager.verifyNoMoreInteractions((file, line))
mock2.cuckoo_manager.verifyNoMoreInteractions((file, line))
}
Hi @MatyasKriz, thanks a lot for the tip, I've added the second option to our project and it's working perfectly fine (would be a great addition to the lib for sure !)
Hello,
I'm trying to add multiple arguments to a
verifyNoMoreInteractions
instead of calling them one by one on my mocks. The function signature indicates that it should be possible as it takes a variadic argument (like Mockito). However I have an error when doing so :->
Conflicting arguments to generic parameter 'M'
Is there a way to make it work this way ?
Cheers