Ejemplo n.º 1
0
  @Test
  public void save_blankPhoneNumber() {
    Candidate candidate = new CandidateBuilder().withCellPhoneNumber(null).build();
    candidate = candidateDao.save(candidate);
    candidate = candidateDao.findByGuid(candidate.getGuid());

    assertTrue(candidate.getCellPhoneNumber().isBlank());
  }
Ejemplo n.º 2
0
  @Test
  public void save_phoneNumber() {
    PhoneNumber phoneNumber = new PhoneNumberBuilder().build();
    Candidate candidate = new CandidateBuilder().withWorkPhoneNumber(phoneNumber).build();

    candidate = candidateDao.save(candidate);
    candidate = candidateDao.findByGuid(candidate.getGuid());

    assertEquals(phoneNumber, candidate.getWorkPhoneNumber());
  }
Ejemplo n.º 3
0
  @Test
  public void save_addNote() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withNotes(new NoteBuilder().withUser(savedUser).build())
            .build();

    candidate = candidateDao.save(candidate);

    candidate = candidateDao.findByGuid(candidate.getGuid());
    assertEquals(1, candidate.getNotes().size());
  }
Ejemplo n.º 4
0
  @Test
  public void save_name() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withName(new NameBuilder().build())
            .build();

    candidate = candidateDao.save(candidate);

    Candidate found = candidateDao.findByGuid(candidate.getGuid());
    assertEquals(found.getName(), candidate.getName());
  }
Ejemplo n.º 5
0
  @Test
  public void save_addCoverLetter() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withCoverLetter(new CoverLetterBuilder().build())
            .build();

    candidate = candidateDao.save(candidate);
    CoverLetter coverLetter = candidate.getCoverLetter();

    assertNotNull(coverLetter.getId());

    candidate = candidateDao.findByGuid(candidate.getGuid());
    assertEquals(coverLetter.getId(), candidate.getCoverLetter().getId());
  }
Ejemplo n.º 6
0
  @Test
  public void save_addResume() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withResume(new ResumeBuilder().build())
            .build();

    candidate = candidateDao.save(candidate);
    Resume resume = candidate.getResume();

    assertNotNull(resume.getId());

    candidate = candidateDao.findByGuid(candidate.getGuid());
    assertEquals(resume.getId(), candidate.getResume().getId());
  }
Ejemplo n.º 7
0
  @Test
  public void save_removeResume() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withResume(new ResumeBuilder().build())
            .build();
    candidate = candidateDao.save(candidate);
    Resume resume = candidate.getResume();

    candidate.setResume(null);
    candidateDao.save(candidate);

    assertNotNull(fileAttachmentDao.findByGuid(resume.getGuid()));

    candidate = candidateDao.findByGuid(candidate.getGuid());
    assertNull(candidate.getResume());
  }
Ejemplo n.º 8
0
  @Test
  public void save_removeCoverLetter() {
    Candidate candidate =
        new CandidateBuilder()
            .withCompany(savedCompany)
            .withCoverLetter(new CoverLetterBuilder().build())
            .build();

    candidate = candidateDao.save(candidate);
    CoverLetter coverLetter = candidate.getCoverLetter();

    candidate.setCoverLetter(null);
    candidateDao.save(candidate);

    assertNotNull(fileAttachmentDao.findByGuid(coverLetter.getGuid()));

    candidate = candidateDao.findByGuid(candidate.getGuid());
    assertNull(candidate.getCoverLetter());
  }