This question just occurred to my mind and I want to ask this here.
The case is intentional, I just write a loop which runs infinitely. How do I go about unit testing it?
I ask this because, this situation may occur anywhere in the code. Say my method delegates to several other methods, and I want to know
- How it ran into an infinite loop
- What set of input caused it
- Call to which method (from this method) has caused this
I have no code written for this. The question is purely for knowledge sake as to what to do if this situation arises in future. Please respond.