@Test public final void canGetAllAccounts() { Account account = new Account("joe", "joe@example.com", "username", "passwordHash", AccountType.Normal, Sets.newHashSet(Role.admin)); given(accountDAO.findAll()).willReturn(ImmutableList.of(account)); List<AccountDto> result = service.getAllAccounts(true); assertThat(result).hasSize(1); }
public List<AccountDto> getAllAccounts(boolean showDisabled) { List<Account> result; if (showDisabled) { result = accountDAO.findAll(); } else { result = accountDAO.findAllEnabled(); } return result.stream() .map(a -> new AccountDto(a.getId(), a.getName(), a.getEmail(), a.getAccountType(), a.getRoles())) .collect(Collectors.toList()); }
AccountService implements Serializable { public List<AccountDto> getAllAccounts(boolean showDisabled) { List<Account> result; if (showDisabled) { result = accountDAO.findAll(); } else { result = accountDAO.findAllEnabled(); } return result.stream() .map(a -> new AccountDto(a.getId(), a.getName(), a.getEmail(), a.getAccountType(), a.getRoles())) .collect(Collectors.toList()); } }
AccountService implements Serializable { public List<AccountDto> getAllAccounts(boolean showDisabled) { List<Account> result; if (showDisabled) { result = accountDAO.findAll(); } else { result = accountDAO.findAllEnabled(); } return result.stream() .map(a -> new AccountDto(a.getId(), a.getName(), a.getEmail(), a.getAccountType(), a.getRoles())) .collect(Collectors.toList()); } @Inject  AccountService(AccountDAO accountDAO); @SuppressWarnings("unused")  AccountService(); }
AccountService implements Serializable { public List<AccountDto> getAllAccounts(boolean showDisabled) { List<Account> result; if (showDisabled) { result = accountDAO.findAll(); } else { result = accountDAO.findAllEnabled(); } return result.stream() .map(a -> new AccountDto(a.getId(), a.getName(), a.getEmail(), a.getAccountType(), a.getRoles())) .collect(Collectors.toList()); } @Inject  AccountService(AccountDAO accountDAO); @SuppressWarnings("unused")  AccountService(); @Transactional AccountDto registerNewAccount(AccountDto accountDto, String username,
            char[] password); Optional<Account> authenticate(String username, String password); List<AccountDto> getAllAccounts(boolean showDisabled); @Transactional boolean updateAccount(AccountDto accountDto); }
AccountService implements Serializable { public List<AccountDto> getAllAccounts(boolean showDisabled) { List<Account> result; if (showDisabled) { result = accountDAO.findAll(); } else { result = accountDAO.findAllEnabled(); } return result.stream() .map(a -> new AccountDto(a.getId(), a.getName(), a.getEmail(), a.getAccountType(), a.getRoles())) .collect(Collectors.toList()); } @Inject  AccountService(AccountDAO accountDAO); @SuppressWarnings("unused")  AccountService(); @Transactional AccountDto registerNewAccount(AccountDto accountDto, String username,
            char[] password); Optional<Account> authenticate(String username, String password); List<AccountDto> getAllAccounts(boolean showDisabled); @Transactional boolean updateAccount(AccountDto accountDto);  }