Testing Main Paths with System Tests
On top of the pyramid of system tests, a system test starts up the whole application and runs requests against its API, verifying that all our layers work in concert.
In a system test for the "Send Money" use case, we send an HTTP request to the application and validate the response as well as the new balance of the account:
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
class SendMoneySystemTest {
  @Autowired
  private TestRestTemplate restTemplate;
  @Test
  @Sql("SendMoneySystemTest.sql")
  void sendMoney() {
 Â
    Money initialSourceBalance = sourceAccount().calculateBalance();
    Money initialTargetBalance = targetAccount().calculateBalance();
 Â
    ResponseEntity response = whenSendMoney(
        sourceAccountId(),
       ...