Removing race conditions from the tests by mocking the executor.