@Test public void shouldNotRemoveCompensationDaysIfHiredPreviously() { List<Holiday> holidays = this.getListOfCompensationDays(1); LocalDate hiringDate = new GregorianCalendar(2018, Calendar.JANUARY, 10).getTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); List<Holiday> result = sut.getCorrespondingHolidays(holidays, hiringDate, 2019); assertThat(result, is(not(empty()))); }
protected List<Holiday> getCorrespondingHolidays(List<Holiday> holidays, LocalDate hiringDate, int yearOfCalculation) { List<Holiday> holidaysFromCalculationYear = holidays.stream() .filter(holiday -> parseDate(holiday.getDate()).getYear() == yearOfCalculation) .collect(Collectors.toList()); if (isHiringYearThisYear(yearOfCalculation, hiringDate)) { removeCompensationDays(holidaysFromCalculationYear, yearOfCalculation, hiringDate); } return holidaysFromCalculationYear; }
CorrespondingHolidayManager { protected List<Holiday> getCorrespondingHolidays(List<Holiday> holidays, LocalDate hiringDate, int yearOfCalculation) { List<Holiday> holidaysFromCalculationYear = holidays.stream() .filter(holiday -> parseDate(holiday.getDate()).getYear() == yearOfCalculation) .collect(Collectors.toList()); if (isHiringYearThisYear(yearOfCalculation, hiringDate)) { removeCompensationDays(holidaysFromCalculationYear, yearOfCalculation, hiringDate); } return holidaysFromCalculationYear; } }
CorrespondingHolidayManager { protected List<Holiday> getCorrespondingHolidays(List<Holiday> holidays, LocalDate hiringDate, int yearOfCalculation) { List<Holiday> holidaysFromCalculationYear = holidays.stream() .filter(holiday -> parseDate(holiday.getDate()).getYear() == yearOfCalculation) .collect(Collectors.toList()); if (isHiringYearThisYear(yearOfCalculation, hiringDate)) { removeCompensationDays(holidaysFromCalculationYear, yearOfCalculation, hiringDate); } return holidaysFromCalculationYear; } protected  CorrespondingHolidayManager(); }
CorrespondingHolidayManager { protected List<Holiday> getCorrespondingHolidays(List<Holiday> holidays, LocalDate hiringDate, int yearOfCalculation) { List<Holiday> holidaysFromCalculationYear = holidays.stream() .filter(holiday -> parseDate(holiday.getDate()).getYear() == yearOfCalculation) .collect(Collectors.toList()); if (isHiringYearThisYear(yearOfCalculation, hiringDate)) { removeCompensationDays(holidaysFromCalculationYear, yearOfCalculation, hiringDate); } return holidaysFromCalculationYear; } protected  CorrespondingHolidayManager(); static CorrespondingHolidayManager getDefault(); List<Holiday> calculateCorrespondingHolidays(Calendar calMin, Calendar calMax, List<Holiday> allHolidays,
			Date hiringDate); }
CorrespondingHolidayManager { protected List<Holiday> getCorrespondingHolidays(List<Holiday> holidays, LocalDate hiringDate, int yearOfCalculation) { List<Holiday> holidaysFromCalculationYear = holidays.stream() .filter(holiday -> parseDate(holiday.getDate()).getYear() == yearOfCalculation) .collect(Collectors.toList()); if (isHiringYearThisYear(yearOfCalculation, hiringDate)) { removeCompensationDays(holidaysFromCalculationYear, yearOfCalculation, hiringDate); } return holidaysFromCalculationYear; } protected  CorrespondingHolidayManager(); static CorrespondingHolidayManager getDefault(); List<Holiday> calculateCorrespondingHolidays(Calendar calMin, Calendar calMax, List<Holiday> allHolidays,
			Date hiringDate);  }