Search in sources :

Example 21 with SolutionEntity

use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.

the class SolutionsServiceTest method testFindAllWithOptions.

@Test
public void testFindAllWithOptions() throws Exception {
    final List<SolutionEntity> solutionsEntities = this.getSolutionsEntities();
    final List<SolutionModelInterface> solutionsModels = this.getSolutionsModels(solutionsEntities);
    final SolutionsOptionsInterface solutionsOptions = Mockito.mock(SolutionsOptionsInterface.class);
    given(this.solutionsMapper.findAll()).willReturn(solutionsEntities);
    given(solutionsOptions.withRelations(Mockito.anyList())).willReturn(solutionsModels);
    final List<SolutionModelInterface> foundedSolutionsModels = this.solutionsService.findAll(solutionsOptions);
    verify(solutionsOptions).withRelations(solutionsModels);
    Assert.assertEquals(solutionsModels, foundedSolutionsModels);
}
Also used : SolutionModelInterface(easytests.core.models.SolutionModelInterface) SolutionEntity(easytests.core.entities.SolutionEntity) SolutionsOptionsInterface(easytests.core.options.SolutionsOptionsInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 22 with SolutionEntity

use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.

the class SolutionsServiceTest method createSolutionEntityMock.

private SolutionEntity createSolutionEntityMock(Integer id, Integer answerId, Integer pointId) {
    final SolutionEntity solutionEntity = mock(SolutionEntity.class);
    when(solutionEntity.getId()).thenReturn(id);
    when(solutionEntity.getAnswerId()).thenReturn(answerId);
    when(solutionEntity.getPointId()).thenReturn(pointId);
    return solutionEntity;
}
Also used : SolutionEntity(easytests.core.entities.SolutionEntity)

Example 23 with SolutionEntity

use of easytests.core.entities.SolutionEntity in project easy-tests by malinink.

the class SolutionModelTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer id = 1;
    final Integer sort = 1;
    final Integer answerId = 2;
    final Integer pointId = 3;
    SolutionEntity solutionEntity = Mockito.mock(SolutionEntity.class);
    Mockito.when(solutionEntity.getId()).thenReturn(id);
    // Mockito.when(solutionEntity.getSort()).thenReturn(sort);
    Mockito.when(solutionEntity.getAnswerId()).thenReturn(answerId);
    Mockito.when(solutionEntity.getPointId()).thenReturn(pointId);
    final SolutionModelInterface solutionModel = new SolutionModel();
    solutionModel.map(solutionEntity);
    Assert.assertEquals(id, solutionModel.getId());
    // Assert.assertEquals(sort, solutionModel.getSort());
    Assert.assertNull(solutionModel.getPoint());
    Assert.assertNull(solutionModel.getAnswer());
}
Also used : SolutionEntity(easytests.core.entities.SolutionEntity) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

SolutionEntity (easytests.core.entities.SolutionEntity)23 Test (org.junit.Test)12 SolutionModelInterface (easytests.core.models.SolutionModelInterface)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 PointModelInterface (easytests.core.models.PointModelInterface)3 SolutionsOptionsInterface (easytests.core.options.SolutionsOptionsInterface)3 ArrayList (java.util.ArrayList)3 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1 List (java.util.List)1