예제 #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);
  }
예제 #2
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"));
  }
예제 #3
0
 @Test
 public void testFindApplicantByIdWithApplicantRepositoryShouldReturnSetupApplicant()
     throws Exception {
   ApplicantDto result = applicantRepository.findApplicantById(applicant.getId());
   assertNotNull(result);
   assertThat(result.getFirstNameEN(), is("Anat"));
 }
예제 #4
0
 @Test
 public void testGetMaxApplicantIdWithApplicantRepositoryShouldReturnSetupId() throws Exception {
   ApplicantDto result = applicantRepository.getMaxApplicantId();
   assertThat(result.getId(), is(applicant.getId()));
 }
  @Before
  public void setUp() {

    employee = new Employee();
    employee.setIdCard("115310905001-9");
    employee.setNameThai("อภิวาท์");
    employee.setNameEng("apiva");
    employee.setNicknameThai("va");
    employee.setNicknameEng("va");
    employee.setSurnameThai("กิมเกถนอม");
    employee.setSurnameEng("kimkatanom");

    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    String dateInString = "31-08-1982";
    Date date = null;
    try {
      date = sdf.parse(dateInString);
    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    employee.setDateOfBirth(date);
    employee.setEmail("*****@*****.**");
    employee.setEmergencyContact("mom");
    employee.setEmployeeCode("EMP-09");
    employee.setStatusemp("Employee");
    employee.setTelHome("089-0851022");
    employee.setTelMobile("089-0851022");
    employee.setEmergencyContactPhoneNumber("089-085-1022");
    employee.setAuditFlag("C");
    employee.setCreatedBy(1);
    employee.setCreatedTimeStamp(Calendar.getInstance().getTime());

    MasTechnology masTechnology = new MasTechnology();
    masTechnology.setName("java");
    masTechnology.setCode("001A");
    masTechnology.setIsActive(true);
    masTechnology.setAuditFlag("C");
    masTechnology.setCreatedBy(0);
    Calendar cal = Calendar.getInstance();
    masTechnology.setCreatedTimeStamp(cal.getTime());
    masTechnologyRepository.create(masTechnology);
    mastec = masTechnology.getId();

    MasTechnology mTechnology = masTechnologyRepository.find(mastec);

    MasJoblevel masJoblevel = new MasJoblevel();
    masJoblevel.setName("CEO");
    masJoblevel.setIsActive(true);
    masJoblevel.setCode("01");
    masJoblevel.setAuditFlag("C");
    masJoblevel.setCreatedBy(1);
    masJoblevel.setCreatedTimeStamp(Calendar.getInstance().getTime());
    masJoblevel.setCode("Division-01");

    masJoblevelRepository.create(masJoblevel);
    masjobId = masJoblevel.getId();
    MasJoblevel mJob = masJoblevelRepository.find(masjobId);

    Applicant applicant = new Applicant();
    applicant.setCreatedBy(1);
    applicant.setCreatedTimeStamp(Calendar.getInstance().getTime());
    applicant.setAuditFlag("C");
    applicant.setCardId("115310905001-9");
    applicant.setTechnology(mTechnology);
    applicant.setJoblevel(mJob);
    applicantRepository.create(applicant);
    int appId = applicant.getId();
    Applicant applicant1 = applicantRepository.find(appId);
    Hibernate.initialize(applicant1);

    employee.setApplicant(applicant1);

    MasDivision masDivision = new MasDivision();
    masDivision.setName("CEO");
    masDivision.setIsActive(true);
    masDivision.setCode("01");
    masDivision.setAuditFlag("C");
    masDivision.setCreatedBy(1);
    masDivision.setCreatedTimeStamp(Calendar.getInstance().getTime());
    masDivision.setCode("Division-01");

    masDivisionRepository.create(masDivision);
    int masDivisionId = masDivision.getId();
    masDivisionRepository.find(masDivisionId);
    employee.setMasDivision(masDivision);

    employee.setMasJoblevel(mJob);
    employeeRepository.create(employee);

    Calendar calendarStartDate =
        new GregorianCalendar(2013, 10, 28); // GregorianCalendar jan=0,12=Jan
    Calendar calendarEndDate = new GregorianCalendar(2014, 11, 28);

    Site site = new Site();
    site.setProjectName("Augmentis-01");
    site.setStartDate(calendarStartDate.getTime());
    site.setEndDate(calendarEndDate.getTime());
    site.setProjectOwner("Augmentis");
    site.setProjectOwnerContact("PM");
    site.setEmployee(employee);
    site.setAuditFlag("C");
    site.setCreatedBy(1);
    site.setCreatedTimeStamp(Calendar.getInstance().getTime());
    siteRepository.create(site);

    id = site.getId();
  }