Ejemplo n.º 1
0
  @Test
  public void testDeleteWithApplicantRepositoryShouldNotFindApplicantThatDelete() throws Exception {
    Applicant delete = applicantRepository.find(applicant.getId());
    applicantRepository.delete(delete);

    Applicant result = applicantRepository.find(delete.getId());
    assertNull(result);
  }
  public void execute(int repNr) {
    StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
    Applicant applicant = new Applicant("Mr John Smith", 21, MALE);

    if (applicant.isValid()) throw new RuntimeException("Applicant shouldn't be valid");
    ksession.execute(applicant);
    if (!applicant.isValid()) throw new RuntimeException("Applicant should be valid");
  }
Ejemplo n.º 3
0
 @Override
 public int compareTo(Applicant o) {
   if (this.getAverageScore() == o.getAverageScore()) {
     if (this.getLastName().equals(o.getLastName())) {
       return this.getFirstName().compareToIgnoreCase(o.getFirstName());
     } else {
       return this.getLastName().compareToIgnoreCase(o.getLastName());
     }
   } else {
     return this.getAverageScore() - o.getAverageScore();
   }
 }
Ejemplo n.º 4
0
  @Test
  public void childrenHaveHorribleCredit() throws Exception {
    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Peter Gibbons");
    applicant.setAge(8);

    // Invoke the service
    service.operation("process").sendInOut(applicant);

    // validate the results
    Assert.assertEquals(160, applicant.getCreditScore());
  }
Ejemplo n.º 5
0
  @Test
  public void goodCredit() throws Exception {

    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Bill Lumbergh");
    applicant.setCreditScore(700);

    // Invoke the service
    service.operation("process").sendInOut(applicant);

    // validate the results
    Assert.assertTrue(applicant.isApproved());
  }
Ejemplo n.º 6
0
  @Test
  public void lowCredit() throws Exception {

    // Build the request message
    Applicant applicant = new Applicant();
    applicant.setName("Peter Gibbons");
    applicant.setCreditScore(400);

    // Invoke the service
    Applicant reply = service.operation("process").sendInOut(applicant).getContent(Applicant.class);

    // validate the results
    Assert.assertTrue(!reply.isApproved());
  }
Ejemplo n.º 7
0
  @Test
  public void adultsAreResponsible() throws Exception {

    // Build the request message
    Applicant request = new Applicant();
    request.setName("Bill Lumbergh");
    request.setAge(39);

    // Invoke the service
    Applicant reply = service.operation("process").sendInOut(request).getContent(Applicant.class);

    // validate the results
    Assert.assertNotSame(780, reply.getCreditScore());
  }
Ejemplo n.º 8
0
 @Test
 public void testCheckTagWithApplicantRepositoryShouldReturnListOfJobLevelThatHaveTagSameSetup()
     throws Exception {
   List<JoblevelDto> result = applicantRepository.checkTag(applicant.getJobLevel().getTag());
   assertNotNull(result);
   assertThat(result.get(0).getTag(), is("t"));
 }
Ejemplo n.º 9
0
 @Test
 public void testFindApplicantByIdWithApplicantRepositoryShouldReturnSetupApplicant()
     throws Exception {
   ApplicantDto result = applicantRepository.findApplicantById(applicant.getId());
   assertNotNull(result);
   assertThat(result.getFirstNameEN(), is("Anat"));
 }
Ejemplo n.º 10
0
 @Test
 public void
     testFindByTrackingStatusWithApplicantRepositoryShouldReturnListOfApplicantThatHaveTrackingStatusSameSetup()
         throws Exception {
   List<ApplicantDto> result =
       applicantRepository.findByTrackingStatus(applicant.getTrackingStatus());
   assertNotNull(result);
   assertThat(result.get(0).getTrackingStatus(), is("Interview"));
 }
Ejemplo n.º 11
0
 @Test
 public void
     testFindByJobLevelWithApplicantRepositoryShouldReturnListOfApplicantThatHaveSetupJobLevel()
         throws Exception {
   List<ApplicantDto> result =
       applicantRepository.findByJoblevel(applicant.getJobLevel().getName());
   assertNotNull(result);
   assertThat(result.get(0).getJoblevelStr(), is("Consultant"));
 }
Ejemplo n.º 12
0
  @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"));
  }
Ejemplo n.º 13
0
  @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);
  }
Ejemplo n.º 14
0
 @Test
 public void testGetMaxApplicantIdWithApplicantRepositoryShouldReturnSetupId() throws Exception {
   ApplicantDto result = applicantRepository.getMaxApplicantId();
   assertThat(result.getId(), is(applicant.getId()));
 }