use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testFind_HourTypeNotExists.
@Test
public void testFind_HourTypeNotExists() {
HourTypeRepository.HourTypeQuery query = Mockito.mock(HourTypeRepository.HourTypeQuery.class, Mockito.RETURNS_DEEP_STUBS);
EasyMock.expect(hourTypeRepository.query()).andReturn(query);
Mockito.when(query.id(1L).getSingleResultOrNull()).thenReturn(null);
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.find(1L);
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.id(1L)).getSingleResultOrNull();
assertNull(actual);
}
use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testFind_HourTypeExists.
@Test
public void testFind_HourTypeExists() {
HourType hourType = createHourType(1L);
HourTypeRepository.HourTypeQuery query = Mockito.mock(HourTypeRepository.HourTypeQuery.class, Mockito.RETURNS_DEEP_STUBS);
EasyMock.expect(hourTypeRepository.query()).andReturn(query);
Mockito.when(query.id(1L).getSingleResultOrNull()).thenReturn(hourType);
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.find(1L);
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.id(1L)).getSingleResultOrNull();
assertEquals(hourType, actual);
}
use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testFindActualTime_HourTypeNotExists.
@Test
public void testFindActualTime_HourTypeNotExists() {
HourTypeRepository.HourTypeQuery query = Mockito.mock(HourTypeRepository.HourTypeQuery.class, Mockito.RETURNS_DEEP_STUBS);
EasyMock.expect(hourTypeRepository.query()).andReturn(query);
Mockito.when(query.actualTime().getSingleResultOrNull()).thenReturn(null);
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.findActualTime();
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.actualTime()).getSingleResultOrNull();
assertNull(actual);
}
use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testCreate_ActualTimeExists.
@Test
public void testCreate_ActualTimeExists() {
HourType hourType = createHourType(1L);
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(createHourType(2L));
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.create(hourType);
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.actualTime()).getSingleResultOrNull();
assertEquals(hourType, actual);
}
use of com.artezio.arttime.repositories.HourTypeRepository in project ART-TIME by Artezio.
the class HourTypeServiceTest method testFindActualTime_HourTypeExists.
@Test
public void testFindActualTime_HourTypeExists() {
HourType hourType = createHourType(1L);
HourTypeRepository.HourTypeQuery query = Mockito.mock(HourTypeRepository.HourTypeQuery.class, Mockito.RETURNS_DEEP_STUBS);
EasyMock.expect(hourTypeRepository.query()).andReturn(query);
Mockito.when(query.actualTime().getSingleResultOrNull()).thenReturn(hourType);
EasyMock.replay(hourTypeRepository);
HourType actual = hourTypeService.findActualTime();
EasyMock.verify(hourTypeRepository);
Mockito.verify(query.actualTime()).getSingleResultOrNull();
assertEquals(hourType, actual);
}
Aggregations