示例#1
0
  @Test
  public void findAllByCompanyIdAndStatus() {

    Candidate notTestedCandidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withStatus(Candidate.Status.NOT_TESTED)
            .build();

    Candidate hiredCandidate =
        new CandidateBuilder().withCompany(savedCompany).withStatus(Candidate.Status.HIRED).build();

    candidateDao.save(notTestedCandidate);
    candidateDao.save(hiredCandidate);

    List<Candidate> result =
        candidateDao.findAllByCompanyIdAndStatus(
            savedCompany.getId(), Candidate.Status.NOT_TESTED, page1With50PerPage);

    assertEquals(1, result.size());
    assertEquals(notTestedCandidate.getId(), result.get(0).getId());

    result =
        candidateDao.findAllByCompanyIdAndStatus(
            savedCompany.getId(), Candidate.Status.HIRED, page1With50PerPage);
    assertEquals(1, result.size());
    assertEquals(hiredCandidate.getId(), result.get(0).getId());
  }
示例#2
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());
  }
示例#3
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()));
  }