how can we write test case for this scenario ?