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);
}
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);
}
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());
}
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);
}
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);
}
Aggregations