Sometimes there are sections of code that are difficult to test, such as accessing a database, or interacting with the user. You can stub out those sections of code, allowing the rest of the code to be tested.
Let's start with a class that prompts the user. For simplicity, it has only two methods...