Method in service class:
@Override
@Transactional(readOnly = true)
public Collection<Account> searchAccounts(String partOfName) {
Collection<Account> accounts = accountDao.getAll();
CollectionUtils.filter(accounts, account ->
account.getName().toLowerCase().contains(partOfName.toLowerCase()) ||
account.getSurname().toLowerCase().equalsIgnoreCase(partOfName.toLowerCase()));
return accounts;
}
I am not understand what i must do with CollectionUtils.filter. mock this too? Now i have this in test class:
@Test
public void searchAccountsByPartOfName() throws ParseException {
service.searchAccounts("test");
verify(accountDao, times(1)).getAll();
}
Aucun commentaire:
Enregistrer un commentaire