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