@Test public void testDeleteWithApplicantRepositoryShouldNotFindApplicantThatDelete() throws Exception { Applicant delete = applicantRepository.find(applicant.getId()); applicantRepository.delete(delete); Applicant result = applicantRepository.find(delete.getId()); assertNull(result); }
@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")); }
@Test public void testFindReportByMonthWithApplicantRepositoryShouldReturnListOfReportApplicant() throws Exception { List<ReportApplicantDto> result = applicantRepository.findReportByMonth(startDate, endDate); assertNotNull(result); assertThat(result.size(), is(new GreaterOrEqual<>(1))); }
@Test public void testReportApplicantWithApplicantRepositoryShouldReturnListOfReportApplicant() throws Exception { List<ReportApplicantDto> result = applicantRepository.reportApplicant(); assertNotNull(result); assertThat(result.size(), is(new GreaterOrEqual<>(1))); }
@Test public void testCheckTagWithApplicantRepositoryShouldReturnListOfJobLevelThatHaveTagSameSetup() throws Exception { List<JoblevelDto> result = applicantRepository.checkTag(applicant.getJobLevel().getTag()); assertNotNull(result); assertThat(result.get(0).getTag(), is("t")); }
@Test public void testFindApplicantByIdWithApplicantRepositoryShouldReturnSetupApplicant() throws Exception { ApplicantDto result = applicantRepository.findApplicantById(applicant.getId()); assertNotNull(result); assertThat(result.getFirstNameEN(), is("Anat")); }
@Test public void testFindByTrackingStatusWithApplicantRepositoryShouldReturnListOfApplicantThatHaveTrackingStatusSameSetup() throws Exception { List<ApplicantDto> result = applicantRepository.findByTrackingStatus(applicant.getTrackingStatus()); assertNotNull(result); assertThat(result.get(0).getTrackingStatus(), is("Interview")); }
@Test public void testFindByJobLevelWithApplicantRepositoryShouldReturnListOfApplicantThatHaveSetupJobLevel() throws Exception { List<ApplicantDto> result = applicantRepository.findByJoblevel(applicant.getJobLevel().getName()); assertNotNull(result); assertThat(result.get(0).getJoblevelStr(), is("Consultant")); }
@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); }
@Test public void testGetMaxApplicantIdWithApplicantRepositoryShouldReturnSetupId() throws Exception { ApplicantDto result = applicantRepository.getMaxApplicantId(); assertThat(result.getId(), is(applicant.getId())); }
@Test public void testFindAllWithApplicantRepositoryShouldReturnListOfApplicant() throws Exception { List<Applicant> result = applicantRepository.findAll(); assertNotNull(result); assertThat(result.size(), is(new GreaterOrEqual<>(1))); }