Beispiel #1
0
  @Test
  public void testFindByEmail() {
    Member member = memberDao.findByEmail("*****@*****.**");

    Assert.assertEquals("John Smith", member.getName());
    Assert.assertEquals("*****@*****.**", member.getEmail());
    Assert.assertEquals("2125551212", member.getPhoneNumber());
    return;
  }
Beispiel #2
0
  @Test
  public void testFindAllOrderedByName() {
    Member member = new Member();
    member.setEmail("*****@*****.**");
    member.setName("Jane Doe");
    member.setPhoneNumber("2125552121");
    memberDao.register(member);

    List<Member> members = memberDao.findAllOrderedByName();
    Assert.assertEquals(2, members.size());
    Member newMember = members.get(0);

    Assert.assertEquals("Jane Doe", newMember.getName());
    Assert.assertEquals("*****@*****.**", newMember.getEmail());
    Assert.assertEquals("2125552121", newMember.getPhoneNumber());
    return;
  }
Beispiel #3
0
  @Test
  public void testRegister() {
    Member member = new Member();
    member.setEmail("*****@*****.**");
    member.setName("Jane Doe");
    member.setPhoneNumber("2125552121");

    memberDao.register(member);
    Long id = member.getId();
    Assert.assertNotNull(id);

    Assert.assertEquals(2, memberDao.findAllOrderedByName().size());
    Member newMember = memberDao.findById(id);

    Assert.assertEquals("Jane Doe", newMember.getName());
    Assert.assertEquals("*****@*****.**", newMember.getEmail());
    Assert.assertEquals("2125552121", newMember.getPhoneNumber());
    return;
  }