use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testCreate_ActualTimeNotExists.
@Test
public void testCreate_ActualTimeNotExists() {
HourType hourType = createHourType(1L);
hourType.setActualTime(true);
HourTypeRepository.HourTypeQuery query = Mockito.mock(HourTypeRepository.HourTypeQuery.class, Mockito.RETURNS_DEEP_STUBS);
EasyMock.expect(hourTypeRepository.query()).andReturn(query);
EasyMock.expect(hourTypeRepository.create(hourType)).andReturn(hourType);
Mockito.when(query.actualTime().getSingleResultOrNull()).thenReturn(null);
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.create(hourType);
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.actualTime()).getSingleResultOrNull();
assertEquals(hourType, actual);
}
Aggregations