Search in sources :

Example 56 with WorkdaysCalendar

use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.

the class WorkdaysCalendarBeanTest method createDay.

private Day createDay(Long id, Date date) throws Exception {
    WorkdaysCalendar workdaysCalendar = new WorkdaysCalendar();
    setField(calendarBean, "workdaysCalendar", workdaysCalendar);
    Day day = new Day(date, workdaysCalendar);
    setField(day, "id", id);
    return day;
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Day(com.artezio.arttime.datamodel.Day)

Example 57 with WorkdaysCalendar

use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.

the class EmployeesBeanTest method testFilterByCalendar_FilterIsEmpty.

@Test
public void testFilterByCalendar_FilterIsEmpty() throws NoSuchFieldException {
    WorkdaysCalendar calendar = new WorkdaysCalendar("calendar1");
    setField(calendar, "id", 1L);
    List<WorkdaysCalendar> filter = Collections.emptyList();
    boolean actual = bean.filterByCalendar(calendar, filter, null);
    assertTrue(actual);
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Test(org.junit.Test)

Example 58 with WorkdaysCalendar

use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.

the class EmployeesBeanTest method testFilterByCalendar.

@Test
public void testFilterByCalendar() throws NoSuchFieldException {
    WorkdaysCalendar calendar1 = new WorkdaysCalendar("calendar1");
    setField(calendar1, "id", 1L);
    WorkdaysCalendar calendar2 = new WorkdaysCalendar("calendar2");
    setField(calendar2, "id", 2L);
    List<WorkdaysCalendar> filter = Arrays.asList(calendar1, calendar2);
    boolean actual = bean.filterByCalendar(calendar1, filter, null);
    assertTrue(actual);
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Test(org.junit.Test)

Example 59 with WorkdaysCalendar

use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.

the class WorkdaysCalendarConverterTest method testGetAsObject_ifFoundInRepository.

@Test
public void testGetAsObject_ifFoundInRepository() throws Exception {
    WorkdaysCalendar calendar = new WorkdaysCalendar();
    expect(workdaysCalendarRepository.findWorkdaysCalendar(1L)).andReturn(calendar);
    replay(workdaysCalendarRepository);
    Object actual = converter.getAsObject(facesContext, component, "1");
    verify(workdaysCalendarRepository);
    assertSame(calendar, actual);
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Test(org.junit.Test)

Example 60 with WorkdaysCalendar

use of com.artezio.arttime.datamodel.WorkdaysCalendar in project ART-TIME by Artezio.

the class WorkdaysCalendarConverterTest method testGetAsString_ifWorkdaysCalendar.

@Test
public void testGetAsString_ifWorkdaysCalendar() throws Exception {
    WorkdaysCalendar workdaysCalendar = new WorkdaysCalendar();
    setField(workdaysCalendar, "id", 1L);
    String actual = converter.getAsString(facesContext, component, workdaysCalendar);
    assertEquals("1", actual);
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Test(org.junit.Test)

Aggregations

WorkdaysCalendar (com.artezio.arttime.datamodel.WorkdaysCalendar)76 Test (org.junit.Test)65 Day (com.artezio.arttime.datamodel.Day)23 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)17 Employee (com.artezio.arttime.datamodel.Employee)16 Period (com.artezio.arttime.datamodel.Period)11 Date (java.util.Date)10 Project (com.artezio.arttime.datamodel.Project)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7 SimpleDateFormat (java.text.SimpleDateFormat)5 DateFormat (java.text.DateFormat)3 Before (org.junit.Before)3 HourType (com.artezio.arttime.datamodel.HourType)2 Hours (com.artezio.arttime.datamodel.Hours)2 EmployeeRepository (com.artezio.arttime.repositories.EmployeeRepository)2 BigDecimal (java.math.BigDecimal)2 GregorianCalendar (java.util.GregorianCalendar)2 HashMap (java.util.HashMap)2 WebCached (com.artezio.arttime.admin_tool.cache.WebCached)1 Scope (com.artezio.arttime.admin_tool.cache.WebCached.Scope)1