Software Quality and Testing, Assignment 2.
Implements Bank Account application with an HTTP API (Spring Framework) using JDBC (Spring Data).
The application consists of controller, model, repository and service type of components.
A @RestController
used to broke RPC over HTTP instances to the required service calls.
Mockito.when(this.accountService.findAccountsByFirstNameAndLastName(COMMON_FIRST_NAME, COMMON_LAST_NAME)).thenReturn(Collections.singletonList(this.firstAccount));
Mockito.when(this.accountService.deposit(this.firstAccount.getId(), DEPOSIT_AMOUNT)).thenReturn(this.nilAccount);
Mockito.when(this.accountService.transfer(this.firstAccount.getId(), this.secondAccount.getId(), TRANSFER_AMOUNT)).thenReturn(this.nilAccount);
A single-bean contained service managing repository calls.
Mockito.when(accountRepository.findByOwnerFirstNameAndOwnerLastName(COMMON_FIRST_NAME, COMMON_LAST_NAME)).thenReturn(Collections.singletonList(firstAccount));
Mockito.when(accountRepository.findOne(FIRST_USER_IDENTIFIER)).thenReturn(firstAccount);
Mockito.when(accountRepository.findOne(SECOND_USER_IDENTIFIER)).thenReturn(secondAccount);