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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -