I am trying to test a set of API's from a Android library. One of such api is a synchronous method which returns immediately after called with the status. But internally that method will create few threads to do some background tasks.
Here when I write a junit test case to test this api, my test case calls the api and then ends the tests. I need to make my testcase to wait for sometime till the thread which is created by that api also completes its tasks.
When tried thread.sleep()
junit pauses the thread, and nothing proceeds.
How do I make my junit testcase to wait until other threads created by the testing method is completed ?