Ejemplo n.º 1
0
  @Test(groups = "int")
  public void testGetByName() {
    User user = UserFactory.getNewRetailUser("1");
    deleteList.add(user);
    mongoUserDao.save(user);

    List<User> users = mongoUserDao.findByName(user.getFirstName());

    assertNotNull(users, "The user list should not be null");
    assertFalse(users.isEmpty(), "The user list should not be empty");
    assertEquals(users.size(), 1, "There should be exactly 1 match");
    assertEquals(users.get(0), user, "The users should match");

    users = mongoUserDao.findByName(user.getFirstName().toUpperCase());
    assertNotNull(users, "The user list should not be null");
    assertFalse(users.isEmpty(), "The user list should not be empty");
    assertEquals(users.size(), 1, "There should be exactly 1 match");
    assertEquals(users.get(0), user, "The users should match");
  }