예제 #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());
  }
예제 #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());
  }