コード例 #1
0
  @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());
  }
コード例 #2
0
  @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()));
  }
コード例 #3
0
 @Test
 public void findByEmailOrNull_failed() {
   Candidate result = candidateDao.findByEmailOrNull(TestUtils.uniqueEmail());
   assertNull(result);
 }