Search in sources :

Example 1 with SelectEvent

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());
}
Also used : Period(com.artezio.arttime.datamodel.Period) SelectEvent(org.primefaces.event.SelectEvent) Day(com.artezio.arttime.datamodel.Day) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

Day (com.artezio.arttime.datamodel.Day)1 Period (com.artezio.arttime.datamodel.Period)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 SelectEvent (org.primefaces.event.SelectEvent)1