How do I write a JUnit test case to test threads and events

前端 未结 7 883
无人共我
无人共我 2020-12-09 17:07

I have a java code which works in one (main) thread. From the main thread, i spawn a new thread in which I make a server call. After the server call is done, I am doing some

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 17:36

    I suggest you use a mocking framework, to confirm that the server call was indeed made. As for the thread unit testing: Unit testing multithreaded applications

提交回复
热议问题