@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()); }
@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()); }