use of org.primefaces.event.SelectEvent in project ART-TIME by Artezio.
the class WorkdaysCalendarBeanTest method testOnDateSelect.
@Test
public void testOnDateSelect() throws Exception {
SelectEvent event = createMock(SelectEvent.class);
Date date1 = sdf.parse("1-01-2015");
Date date2 = sdf.parse("2-01-2015");
Period period = new Period(sdf.parse("1-01-2015"), sdf.parse("16-01-2015"));
Map<Date, Day> days = new HashMap<Date, Day>();
days.put(date1, new Day(date1, null, true));
days.put(date2, new Day(date2, null, true));
setField(calendarBean, "days", days);
setField(calendarBean, "extendedPeriod", period);
expect(event.getObject()).andReturn(date1);
replay(event);
calendarBean.onDateSelect(event);
verify(event);
assertFalse(days.get(date1).isWorking());
assertNotNull(calendarBean.getDaysOff());
}
Aggregations