@Test public void testFindByEmail() { Member member = memberDao.findByEmail("*****@*****.**"); Assert.assertEquals("John Smith", member.getName()); Assert.assertEquals("*****@*****.**", member.getEmail()); Assert.assertEquals("2125551212", member.getPhoneNumber()); return; }
@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; }
@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; }