Пример #1
0
  @Test
  public void shouldAddSalariedEmployee() throws Exception {
    addEmp.addSalariedEmployee(db, data);
    Employee e = db.getEmployee(EmployeeDataUtils.getId(data));
    assertThat(e.getName(), is("Bob"));

    PayType pc = e.getPayType();
    assertThat(pc, instanceOf(Salaried.class));

    Salaried sc = (Salaried) pc;
    assertThat(sc.getSalary(), is((BigDecimal) data.get(Constants.SALARY.name())));

    PaySchedule ps = e.getPaySchedule();
    assertThat(ps, instanceOf(MonthlySchedule.class));

    PayDisposition pm = e.getPayDisposition();
    assertThat(pm, instanceOf(HoldMethod.class));

    UnionMembership af = e.getUnionMembership();
    assertThat(af, instanceOf(NoMember.class));
  }
Пример #2
0
  @Test
  public void shouldAddHourlyEmployee() throws Exception {
    addEmp.addHourlyEmployee(db, data);
    Employee e = db.getEmployee(EmployeeDataUtils.getId(data));

    assertThat(e.getName(), is("Bob"));

    PayType pc = e.getPayType();
    assertThat(pc, instanceOf(Hourly.class));

    Hourly hc = (Hourly) pc;
    assertThat(hc.getHourlyRate(), is((BigDecimal) data.get(Constants.HOURLY_RATE.name())));

    PaySchedule ps = e.getPaySchedule();
    assertThat(ps, instanceOf(WeeklySchedule.class));

    PayDisposition pm = e.getPayDisposition();
    assertThat(pm, instanceOf(HoldMethod.class));

    UnionMembership af = e.getUnionMembership();
    assertThat(af, instanceOf(NoMember.class));
  }
Пример #3
0
  @Test
  public void shouldAddCommissionedEmployee() throws Exception {
    addEmp.addCommissionedEmployee(db, data);

    Employee e = db.getEmployee(EmployeeDataUtils.getId(data));
    assertThat(e.getName(), is("Bob"));

    PayType pc = e.getPayType();
    assertThat(pc, instanceOf(Commissioned.class));

    Commissioned cc = (Commissioned) pc;
    assertThat(cc.getBasePay(), is(((BigDecimal) data.get(Constants.BASE_PAY.name())).setScale(2)));
    assertThat(cc.getCommissionRate(), is((BigDecimal) data.get(Constants.COMMISSION_RATE.name())));

    PaySchedule ps = e.getPaySchedule();
    assertThat(ps, instanceOf(BiweeklySchedule.class));

    PayDisposition pm = e.getPayDisposition();
    assertThat(pm, instanceOf(HoldMethod.class));

    UnionMembership af = e.getUnionMembership();
    assertThat(af, instanceOf(NoMember.class));
  }