Skip to content

Instantly share code, notes, and snippets.

@michal-lipski
Created October 2, 2013 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michal-lipski/6794945 to your computer and use it in GitHub Desktop.
Save michal-lipski/6794945 to your computer and use it in GitHub Desktop.
@Test
public void employee_on_full_month_sick_leave_gets_special_salary_type() throws Exception {
Calendar start = Calendar.getInstance();
start.set(Calendar.YEAR, 2011);
start.set(Calendar.MONTH, DECEMBER - 1); // Januar = 0
start.set(Calendar.DAY_OF_MONTH, 1);
Calendar end = Calendar.getInstance();
start.set(Calendar.YEAR, 2011);
start.set(Calendar.MONTH, DECEMBER - 1); // Januar = 0
start.set(Calendar.DAY_OF_MONTH, 31);
this.employee.setSickFrom(start).to(end);
Salary salary = this.calculator.salaryFor(employee, DECEMBER);
assertNotNull(salary);
SalaryType salaryType = salary.getType();
assertNotNull(salaryType);
assertEquals(SalaryType.SICK, salaryType.getName());
}
@Test
public void employee_on_full_month_sick_leave_gets_special_salary_type() throws Exception {
employee.setSickFrom(date(2011, DECEMBER, 1)).to(date(2011, DECEMBER, 31));
SalaryType salaryType = calculator.salaryFor(employee, DECEMBER);
assertThat(salaryType).isEqualTo(SalaryType.SICK);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment