use of com.artezio.arttime.services.WorkdaysCalendarService in project ART-TIME by Artezio.
the class EffortsBeanTest method testGetDay_ifCalendarDaysNotCached.
@Test
public void testGetDay_ifCalendarDaysNotCached() throws Exception {
Date date1 = sdf.parse("1-05-2015");
Date date2 = sdf.parse("2-05-2015");
WorkdaysCalendar calendar = new WorkdaysCalendar();
Day day1 = new Day(date1, calendar, false);
Day day2 = new Day(date2, calendar, false);
Filter filter = new Filter();
FilterBean filterBean = createMock(FilterBean.class);
WorkdaysCalendarService workdaysCalendarService = createMock(WorkdaysCalendarService.class);
setField(effortsBean, "filterBean", filterBean);
setField(effortsBean, "workdaysCalendarService", workdaysCalendarService);
expect(filterBean.getCurrentFilter()).andReturn(filter);
expect(workdaysCalendarService.getDays(calendar, filter.getPeriod())).andReturn(Arrays.asList(day1, day2));
replay(filterBean, workdaysCalendarService);
Day actual = effortsBean.getDay(calendar, date1);
verify(filterBean, workdaysCalendarService);
assertSame(day1, actual);
}
Aggregations