CommunityServiceImpl implements CommunityService { @Override @Secured(ADMIN) public Page<User> findAll(Pageable pageable) { return userRepository.findAll(pageable); }  @Override Page<UserActivityDTO> getPublicActivity(Pageable pageable); @Override User findByUserName(String userName); @Override User createUser(User user, Role role); @Override User createUser(User user, Role[] roles); @Override User updateUser(User user); User createUserWithBalance(User user, Role[] roles, BigDecimal balance); @Override Page<UserDTO> search(Specification<User> spec, Pageable pageable); @Override User findOne(String username); @Override @Secured({ADMIN, SYSTEM}) void delete(String userName); @Override @Secured(ADMIN) Page<User> findAll(Pageable pageable); @Override Page<UserDTO> getLeaders(Pageable pageable); @Override UserDTO getUser(String username); @Override User identifyUser(User user); @Override @Secured({ADMIN, SYSTEM}) User getUserByEmail(String email); @Override Set<Authority> createAuthorities(Role[] roles); @Override void save(User user); @Override UserDTO findByLogin(String login); @Override void registerUser(User user); @Override Authentication signInUser(User user); @Override UserDetails loadUserByUsername(String username); @Override boolean isAffordableToUser(int quantity, StockQuote quote, User user, @Nullable CurrencyExchange currencyExchange); @Override void alterUserBalance(int quantity, StockQuote quote, User user, UserActivityType type, @Nullable CurrencyExchange currencyExchange); @Override User hydrate(User user); static final Class<?>[] PUBLIC_ACTIVITY_TYPES; }
@Test public void findAll_usesDAO() { when(userRepository.findAll(userPageable)).thenReturn(userResultsPage); Page<User> userPage = communityServiceImpl.findAll(userPageable); assertEquals(userResultsPage, userPage); verify(userRepository, times(1)).findAll(userPageable); }