-
Couldn't load subscription status.
- Fork 38.8k
Description
Hello,
I just migrate a working code from 3.3.2 to 3.4.0 and when I change my tests to use the new @MockitoSpyBean I got exceptions with Mockito telling me that there is not the expected interaction with my mock. I cannot produce code easily, but here the exception :
Wanted but not invoked:
clientInitiator.start();
-> at quickfix.ThreadedSocketInitiator.start(ThreadedSocketInitiator.java:112)
However, there were exactly 3 interactions with this mock:
clientInitiator.startInitiators();
-> at quickfix.ThreadedSocketInitiator.start(ThreadedSocketInitiator.java:114)
clientInitiator.startSessionTimer();
-> at quickfix.mina.initiator.AbstractSocketInitiator.startInitiators(AbstractSocketInitiator.java:317)
clientInitiator.isLoggedOn();
-> at com.pictet.trading.gateway.FixToHttpIT.should_send_message_in_http(FixToHttpIT.java:133)
Here an extract of the code the producing the exception :
@MockitoSpyBean(name = "clientInitiator")
private Initiator initiator;
...
then(initiator).should().start();The actual class on Github : https://github.com/quickfix-j/quickfixj/blob/QFJ_RELEASE_2_3_1/quickfixj-core/src/main/java/quickfix/ThreadedSocketInitiator.java#L111
As you can see you cannot call startInitiators() without calling start().
If I put back @SpyBean then everything works !
Thank you in advance for your help ππ»