Search in sources :

Example 91 with HourType

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

the class HourTypeRepositoryTest method testCreateHourType_notExistActualTime.

@Test
public void testCreateHourType_notExistActualTime() {
    HourType notActualTime = new HourType("not actual");
    notActualTime.setActualTime(false);
    entityManager.persist(notActualTime);
    HourType hourType = new HourType("hourType");
    hourType.setActualTime(false);
    HourType actual = hourTypeRepository.create(hourType);
    assertEquals(hourType, actual);
    assertTrue(actual.isActualTime());
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 92 with HourType

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

the class HourTypeRepositoryTest method testCreateHourType_ifExistActualTime.

@Test
public void testCreateHourType_ifExistActualTime() {
    HourType actualTime = new HourType("actual");
    actualTime.setActualTime(true);
    entityManager.persist(actualTime);
    HourType hourType = new HourType("hourType");
    hourType.setActualTime(false);
    HourType actual = hourTypeRepository.create(hourType);
    assertEquals(hourType, actual);
    assertFalse(actual.isActualTime());
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 93 with HourType

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

the class HourTypeRepositoryTest method testRemoveHourType.

@Test
public void testRemoveHourType() throws ActualTimeRemovalException {
    HourType hourType = new HourType();
    entityManager.persist(hourType);
    Long id = hourType.getId();
    hourTypeRepository.remove(hourType);
    HourType actual = entityManager.find(HourType.class, id);
    assertNull(actual);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 94 with HourType

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

the class HourTypeRepositoryTest method testFindActual_ifNotSetActualTime.

@Test
public void testFindActual_ifNotSetActualTime() {
    HourType unexpectedType1 = new HourType("unexpected type 1");
    unexpectedType1.setActualTime(false);
    HourType unexpectedType2 = new HourType("unexpected type 2");
    unexpectedType2.setActualTime(false);
    entityManager.persist(unexpectedType1);
    entityManager.persist(unexpectedType2);
    HourType actual = hourTypeRepository.findActual();
    assertNull(actual);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 95 with HourType

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

the class HourTypeRepositoryTest method testFind.

@Test
public void testFind() {
    HourType expected = new HourType();
    HourType unexpected = new HourType();
    entityManager.persist(expected);
    entityManager.persist(unexpected);
    HourType actual = hourTypeRepository.find(expected.getId());
    assertEquals(expected, actual);
}
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