### Question:
AccountService { public Account getAccountById(Long id) { return repository.findById(id).orElse(null); }  boolean isAccountPresent(Long id); Account getAccountById(Long id); List<Account> getAccounts(); Account addAccount(Account account); Account updateAccount(Long id, Account account); void deleteAccount(Long id);  }### Answer:
@Test public void whenIdIsGivenThenItShouldReturnAccount() { Account mockAccount = mock(Account.class); Long id = new Long(1); when(repository.findById(id)).thenReturn(Optional.of(mockAccount)); assertEquals(mockAccount, service.getAccountById(id)); }