@Test public void testFindByUserName() { User expected = userMap.values().iterator().next(); // load user from db User user = userRepository.findByUserName(expected.getUserName()); // verify assertThat(user).is(sameAsUser(expected)); }
@Test public void testFindAll() { // load users from db Map<String, User> resultMap = Maps.uniqueIndex(userRepository.findAll(), userName()); assertThat(resultMap).hasSameSizeAs(userMap.values()); // verify for (User user : userMap.values()) { assertThat(user).is(sameAsUser(resultMap.get(user.getUserName()))); } }