java - mocking up method return invoked in a separate thread using Mockito -
i'm having problem mocking method return value on mock object invoked in new thread. in test have :
@test public void startconnectiontest(){ clientconnection.startconnection(); when(config.getupdateinterval()).thenreturn(1000l); }
the startconnection method creates new thread calls config.getupdateinterval(). mock value not returned. mock method return called once in main thread, late. if replace real object works fine. appreciated.
Comments
Post a Comment