Search in sources :

Example 81 with HourType

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

the class HourTypeDataSetTest method testOpen.

@Test
public void testOpen() throws IllegalAccessException {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put(REPORT_PARAM_NAME_HOUR_TYPE_IDS, new Long[] { 1L, 3L });
    dataSet.open(null, parameters);
    Iterator<HourType> actual = (Iterator) FieldUtils.readField(dataSet, "dataIterator", true);
    List<HourType> hourTypes = new SampleDataRepository().getHourTypes();
    List<HourType> expected = Arrays.asList(hourTypes.get(0), hourTypes.get(2));
    ListAssert.assertEquals(expected, IteratorUtils.toList(actual));
}
Also used : SampleDataRepository(com.artezio.arttime.report.repositories.SampleDataRepository) HourType(com.artezio.arttime.datamodel.HourType) HashMap(java.util.HashMap) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 82 with HourType

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

the class HourTypesBeanTest method testSetActualTime.

@Test
public void testSetActualTime() throws NoSuchFieldException {
    HourType hourType = new HourType();
    setField(bean, "hourTypes", new ArrayList<HourType>());
    setField(bean, "hourTypeService", hourTypeService);
    expect(hourTypeService.setActualTime(hourType)).andReturn(hourType);
    replay(hourTypeService);
    bean.setActualTime(hourType);
    verify(hourTypeService);
    assertNull(getField(bean, "hourTypes"));
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 83 with HourType

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

the class HourTypesBeanTest method testCreate.

@Test
public void testCreate() throws NoSuchFieldException {
    setField(bean, "hourTypeService", hourTypeService);
    HourType hourType = new HourType();
    expect(hourTypeService.create(hourType)).andReturn(hourType);
    replay(hourTypeService);
    bean.create(hourType);
    verify(hourTypeService);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 84 with HourType

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

the class HourTypesBeanTest method testUpdate.

@Test
public void testUpdate() throws NoSuchFieldException {
    setField(bean, "hourTypeService", hourTypeService);
    HourType hourType = new HourType();
    expect(hourTypeService.update(hourType)).andReturn(hourType);
    replay(hourTypeService);
    bean.update(hourType);
    verify(hourTypeService);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 85 with HourType

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

the class HourTypesBeanTest method testRemove.

@Test
public void testRemove() throws ActualTimeRemovalException, NoSuchFieldException {
    setField(bean, "hourTypeService", hourTypeService);
    HourType hourType = new HourType();
    hourTypeService.remove(hourType);
    replay(hourTypeService);
    bean.remove(hourType);
    verify(hourTypeService);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Aggregations

HourType (com.artezio.arttime.datamodel.HourType)172 Test (org.junit.Test)158 Project (com.artezio.arttime.datamodel.Project)120 Employee (com.artezio.arttime.datamodel.Employee)115 Hours (com.artezio.arttime.datamodel.Hours)103 Date (java.util.Date)60 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)54 Period (com.artezio.arttime.datamodel.Period)45 BigDecimal (java.math.BigDecimal)41 CalendarUtils.createPeriod (com.artezio.arttime.test.utils.CalendarUtils.createPeriod)21 HashMap (java.util.HashMap)16 HoursRepository (com.artezio.arttime.repositories.HoursRepository)13 Map (java.util.Map)11 Arrays.asList (java.util.Arrays.asList)10 List (java.util.List)10 Filter (com.artezio.arttime.filter.Filter)7 Mail (com.artezio.arttime.services.mailing.Mail)7 ArrayList (java.util.ArrayList)7 HourTypeRepository (com.artezio.arttime.repositories.HourTypeRepository)6 RangePeriodSelector (com.artezio.arttime.web.criteria.RangePeriodSelector)6