@Test public void testUpdateWithApplicantRepositoryShouldReturnApplicantThatUpdated() throws Exception { Applicant update = applicantRepository.find(applicant.getId()); update.setFirstNameEN("AnatUpdate"); applicantRepository.update(update); Applicant result = applicantRepository.find(update.getId()); assertNotNull(result); assertThat(result.getId(), is(update.getId())); assertThat(result.getFirstNameEN(), is("AnatUpdate")); }
@Before public void setUp() throws Exception { // create applicant MasCoreSkill masCoreSkill = new MasCoreSkill(); masCoreSkill.setAuditFlag("C"); masCoreSkill.setCreatedBy(1); masCoreSkill.setCreatedTimeStamp(Calendar.getInstance().getTime()); masCoreSkill.setIsActive(true); masCoreSkill.setCode("ITS"); masCoreSkill.setName("ITS"); masCoreSkillRepository.create(masCoreSkill); MasJobLevel masJobLevel = new MasJobLevel(); masJobLevel.setAuditFlag("C"); masJobLevel.setCreatedBy(1); masJobLevel.setCreatedTimeStamp(Calendar.getInstance().getTime()); masJobLevel.setIsActive(true); masJobLevel.setCode("C"); masJobLevel.setName("Consultant"); masJobLevel.setTag("t"); masJobLevelRepository.create(masJobLevel); MasTechnology masTechnology = new MasTechnology(); masTechnology.setAuditFlag("C"); masTechnology.setCreatedBy(1); masTechnology.setCreatedTimeStamp(Calendar.getInstance().getTime()); masTechnology.setIsActive(true); masTechnology.setCode("1"); masTechnology.setName("Java"); masTechnologyRepository.create(masTechnology); applicant = new Applicant(); applicant.setAuditFlag("C"); applicant.setCreatedBy(1); applicant.setCreatedTimeStamp(Calendar.getInstance().getTime()); applicant.setCoreSkill(masCoreSkillRepository.find(masCoreSkill.getId())); applicant.setJoblevel(masJobLevelRepository.find(masJobLevel.getId())); applicant.setTechnology(masTechnologyRepository.find(masTechnology.getId())); applicant.setFirstNameEN("Anat"); applicant.setTrackingStatus("Interview"); applicant.setApplyDate(Calendar.getInstance().getTime()); applicantRepository.create(applicant); // create mas degree masDegreeType = new MasDegreeType(); masDegreeType.setName("Bachelor"); masDegreeType.setCode("B"); masDegreeType.setIsactive(true); masDegreeType.setAuditFlag("C"); masDegreeType.setCreatedBy(1); masDegreeType.setCreatedTimeStamp(Calendar.getInstance().getTime()); masDegreeTypeRepository.create(masDegreeType); // first date DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Calendar first = Calendar.getInstance(); first.set(Calendar.DAY_OF_MONTH, 1); Date today = first.getTime(); startDate = df.format(today); // last date Calendar last = Calendar.getInstance(); last.set(Calendar.DAY_OF_MONTH, last.getActualMaximum(Calendar.DAY_OF_MONTH)); Date lastDay = last.getTime(); endDate = df.format(lastDay); }