コード例 #1
0
  @Test
  public void test2SalaryEmployeeCreation() {

    SalaryPayRate spr = new SalaryPayRate();
    spr.setJobRole("Programmer");
    spr.setYearlyRate(50000.00);

    Employee employee =
        service.createNewEmployee("David", "Dobel", "11111111", spr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof SalaryPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }
コード例 #2
0
  @Test
  public void test1HourlyEmployeeCreation() {
    HourlyPayRate hpr = new HourlyPayRate();
    hpr.setJobRole("Programmer");
    hpr.setHourlyPayRate(50.00);
    hpr.setOvertimeRate(75.00);

    Employee employee =
        service.createNewEmployee("Sid", "Waterman", "12341234", hpr, createDefaultAddress());

    flushSession();

    assertTrue(employee.getId() > 0);
    assertTrue(employee.getPay() instanceof HourlyPayRate);
    assertNotNull(employee.getCreatedOn());
    assertEquals("Anonymous", employee.getCreatedBy());
    assertNotNull(employee.getUpdatedBy());
    assertNotNull(employee.getUpdatedOn());
  }