Esempio n. 1
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());
  }
Esempio n. 2
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());
  }