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