Added sleep() in the test, to give the thread time in the test case