@Test(expected = EntityNotFoundException.class) public void getUserByInvalidEMailAddress() throws Exception { DbContext dbContext = contextProvider.getDbContext(); PersonDAO personDAO = dbContext.getPersonDAO(); Person p = personDAO.getByEmailAddress("*****@*****.**"); assertEquals(p, new Person("", "", "", "")); }
@Test public void getByEmailAddress() { try (DbContext dbContext = contextProvider.getDbContext()) { PersonDAO personDAO = dbContext.getPersonDAO(); Person p = personDAO.getByEmailAddress("*****@*****.**"); assertEquals(p.getPersonId(), 2); } catch (Exception e) { e.printStackTrace(); fail("Exception " + e.getMessage()); } }