UserDAO { public List<User> getAll() { return userRepository.findAll(); } @Autowired  UserDAO(UserRepository userRepository, FileDAO fileDAO, ProjectDAO projectDAO,
                   ProjectRepository projectRepository); void create(User newUser); List<User> getAll(); List<User> getAllByRole(UserRole role); User getById(Long id); User getByEmail(String email); User getByUsername(String username); void update(User user); void delete(User authUser, Long id); void delete(User authUser, List<Long> userIds);  }
@Test public void shouldGetAllUsers() { List<User> users = createUsersList(); BDDMockito.given(userRepository.findAll()).willReturn(users); List<User> allUsers = userDAO.getAll(); assertThat(allUsers.size(), is(equalTo(users.size()))); for (User u : allUsers) { Assert.assertTrue(users.contains(u)); } }