Search in sources :

Example 16 with HourType

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

the class HourTypeRepositoryTest method testIsActualTimeExist.

@Test
public void testIsActualTimeExist() {
    HourType actualTime = new HourType("actual");
    actualTime.setActualTime(true);
    HourType hourType = new HourType("hourType");
    entityManager.persist(actualTime);
    entityManager.persist(hourType);
    boolean actual = hourTypeRepository.isActualTimeExist();
    assertTrue(actual);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 17 with HourType

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

the class HourTypeRepositoryTest method testIsActualTimeExist_notExist.

@Test
public void testIsActualTimeExist_notExist() {
    HourType notActualTime = new HourType("not actual");
    notActualTime.setActualTime(false);
    entityManager.persist(notActualTime);
    boolean actual = hourTypeRepository.isActualTimeExist();
    assertFalse(actual);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 18 with HourType

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

the class HourTypeRepositoryTest method testUpdateHourType.

@Test
public void testUpdateHourType() {
    HourType hourType = new HourType();
    hourType.setType("day off");
    entityManager.persist(hourType);
    Long id = hourType.getId();
    String newType = "over time";
    hourType.setType(newType);
    hourTypeRepository.update(hourType);
    entityManager.flush();
    HourType actual = entityManager.find(HourType.class, id);
    assertEquals(newType, actual.getType());
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 19 with HourType

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

the class HourTypeRepositoryTest method testFindActual.

@Test
public void testFindActual() {
    HourType expectedType = new HourType("actual type");
    expectedType.setActualTime(true);
    HourType unexpectedType = new HourType("unexpected type");
    unexpectedType.setActualTime(false);
    entityManager.persist(expectedType);
    entityManager.persist(unexpectedType);
    HourType actual = hourTypeRepository.findActual();
    assertNotNull(actual);
    assertEquals(expectedType, actual);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 20 with HourType

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

the class HourTypeRepositoryTest method testRemoveHourType_ifActualTime.

@Test(expected = com.artezio.arttime.exceptions.ActualTimeRemovalException.class)
public void testRemoveHourType_ifActualTime() throws ActualTimeRemovalException {
    HourType actualTime = new HourType("actual time");
    actualTime.setActualTime(true);
    entityManager.persist(actualTime);
    hourTypeRepository.remove(actualTime);
}
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