Example #1
0
  @Test
  public void findByLogin() throws Exception {
    UserDto dto = new UserDto().setLogin("david").setName("David").setEmail("*****@*****.**");
    when(dao.selectUserByLogin("david")).thenReturn(dto);

    assertThat(finder.findByLogin("david").name()).isEqualTo("David");
  }
Example #2
0
  @Test
  public void findByLogins() throws Exception {
    UserDto david = new UserDto().setLogin("david").setName("David").setEmail("*****@*****.**");
    UserDto john = new UserDto().setLogin("john").setName("John").setEmail("*****@*****.**");
    when(dao.selectUsersByLogins(Arrays.asList("david", "john")))
        .thenReturn(Arrays.asList(david, john));

    Collection<User> users = finder.findByLogins(Arrays.asList("david", "john"));
    assertThat(users).hasSize(2);
    for (User user : users) {
      assertThat(user.login()).isIn("david", "john");
    }
  }
 @Before
 public void setUp() {
   when(userDao.selectActiveUserByLogin("arthur"))
       .thenReturn(new UserDto().setId(100L).setName("arthur"));
   finder = new GroupMembershipFinder(userDao, groupMembershipDao);
 }