@Test public void findByEmailOrNull() { String email = TestUtils.uniqueEmail(); Candidate candidate = new CandidateBuilder().withCompany(savedCompany).withEmail(email).build(); candidate = candidateDao.save(candidate); Candidate found = candidateDao.findByEmailOrNull(email); assertEquals(found.getId(), candidate.getId()); }
@Test public void findByEmailAndCompanyIdOrNull() { Candidate candidate = new CandidateBuilder().withCompany(savedCompany).build(); candidate = candidateDao.save(candidate); Candidate found = candidateDao.findByEmailAndCompanyIdOrNull(candidate.getEmail(), savedCompany.getId()); assertEquals(candidate.getId(), found.getId()); assertNull( candidateDao.findByEmailAndCompanyIdOrNull(TestUtils.uniqueEmail(), savedCompany.getId())); }
@Test public void findByEmailOrNull_failed() { Candidate result = candidateDao.findByEmailOrNull(TestUtils.uniqueEmail()); assertNull(result); }