A test class groups test methods for scenarios involving a particular method’s logic. Each test method checks whether the application behaves as expected in one scenario. section 15.1
For a money transfer method, separate test methods can check what happens when:
- The source or destination account cannot be found. section 15.1
- The source account lacks enough money, an update fails, or the transfer succeeds. section 15.1
Figure 15.3 For any piece of logic you test, you need to find the relevant test scenarios. For each test scenario, you write a test method in a test class. You add the test classes in the app’s Maven project test folder. In this figure, the TransferMoneyUnitTests class is a test class that contains the test scenarios for the transferMoney() method. TransferMoneyUnitTests defines multiple test case methods to test each relevant scenario in the transferMoney()’s method logic.

The diagram shows a transfer-focused test class containing separate methods for relevant scenarios. section 15.1
