implemented the waitFor method in the first test case