### Question:
AccountService { public List<Account> list(long userId) { return accountRepository.findByUserId(userId); } @Autowired  AccountService(AccountRepository accountRepository, UserRepository userRepository); List<Account> list(long userId); Account get(long id); Account create(long userId, String description, boolean onBudget);  }### Answer:
@Test public void shouldListAccounts() { User bob = UserTestUtils.createBob(); Account checkings = AccountTestUtils.createCheckingsAccount(bob); Account savings = AccountTestUtils.createSavingsAccount(bob); when(accountRepositoryMock.findByUserId(bob.getId())).thenReturn(asList(checkings, savings)); List<Account> accounts = testSubject.list(bob.getId()); assertThat(accounts).containsExactlyInAnyOrder(checkings, savings); }