Search in sources :

Example 6 with HourTypeRepository

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);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType) HourTypeRepository(com.artezio.arttime.repositories.HourTypeRepository) Test(org.junit.Test)

Aggregations

HourType (com.artezio.arttime.datamodel.HourType)6 HourTypeRepository (com.artezio.arttime.repositories.HourTypeRepository)6 Test (org.junit.Test)6