use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsServiceTest method testFindByPointWithOptions.
@Test
public void testFindByPointWithOptions() throws Exception {
final ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class);
final PointModelInterface pointModel = this.pointsSupport.getModelFixtureMock(0);
final List<SolutionEntity> solutionsEntities = this.getSolutionsFixturesEntities();
when(this.solutionsMapper.findByPointId(pointModel.getId())).thenReturn(solutionsEntities);
final List<SolutionModelInterface> solutionsModels = this.getSolutionsFixturesModels();
final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
when(solutionsOptions.withRelations(listCaptor.capture())).thenReturn(solutionsModels);
final List<SolutionModelInterface> solutionsFoundedModels = this.solutionsService.findByPoint(pointModel, solutionsOptions);
this.assertServicesSet(solutionsOptions);
this.solutionsSupport.assertModelsListEquals(solutionsModels, listCaptor.getValue());
Assert.assertSame(solutionsModels, solutionsFoundedModels);
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsSupport method assertEntitiesListEquals.
public void assertEntitiesListEquals(List<SolutionEntity> expected, List<SolutionEntity> actual) {
Assert.assertEquals(expected.size(), actual.size());
Integer i = 0;
for (SolutionEntity solutionEntity : expected) {
this.assertEquals(solutionEntity, actual.get(i));
i++;
}
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsSupport method getEntityMock.
private SolutionEntity getEntityMock(Integer id, Integer answerId, Integer pointId) {
final SolutionEntity solutionEntity = Mockito.mock(SolutionEntity.class);
Mockito.when(solutionEntity.getId()).thenReturn(id);
Mockito.when(solutionEntity.getAnswerId()).thenReturn(answerId);
Mockito.when(solutionEntity.getPointId()).thenReturn(pointId);
return solutionEntity;
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<SolutionEntity> solutionsFoundedEntities = this.solutionsMapper.findAll();
Assert.assertEquals(5, solutionsFoundedEntities.size());
Integer index = 0;
for (SolutionEntity solutionEntity : solutionsFoundedEntities) {
final SolutionEntity solutionFixtureEntity = this.solutionsSupport.getEntityFixtureMock(index);
this.solutionsSupport.assertEquals(solutionFixtureEntity, solutionEntity);
index++;
}
}
use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.
the class SolutionsMapperTest method testInsert.
@Test
public void testInsert() throws Exception {
final ArgumentCaptor<Integer> id = ArgumentCaptor.forClass(Integer.class);
final SolutionEntity solutionUnidentifiedEntity = this.solutionsSupport.getEntityAdditionalMock(0);
this.solutionsMapper.insert(solutionUnidentifiedEntity);
verify(solutionUnidentifiedEntity, times(1)).setId(id.capture());
Assert.assertNotNull(id.getValue());
final SolutionEntity solutionInsertedEntity = this.solutionsMapper.find(id.getValue());
Assert.assertNotNull(solutionInsertedEntity);
this.solutionsSupport.assertEqualsWithoutId(solutionUnidentifiedEntity, solutionInsertedEntity);
}
Aggregations