Search in sources :

Example 6 with QuizModelInterface

use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.

the class QuizzesServiceTest method testDeleteModelsListWithOptions.

@Test
public void testDeleteModelsListWithOptions() throws Exception {
    final ArgumentCaptor<QuizModelInterface> quizModelCaptor = ArgumentCaptor.forClass(QuizModelInterface.class);
    final List<QuizModelInterface> quizzesModels = this.getQuizzesFixturesModels();
    final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
    this.quizzesService.delete(quizzesModels, quizzesOptions);
    this.assertServicesSet(quizzesOptions, quizzesModels.size());
    verify(quizzesOptions, times(quizzesModels.size())).deleteWithRelations(quizModelCaptor.capture());
    this.quizzesSupport.assertModelsListEquals(quizzesModels, quizModelCaptor.getAllValues());
    verifyNoMoreInteractions(this.quizzesMapper);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) QuizzesOptionsInterface(easytests.core.options.QuizzesOptionsInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with QuizModelInterface

use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.

the class QuizzesServiceTest method testFindByIssueAbsentList.

@Test
public void testFindByIssueAbsentList() throws Exception {
    final IssueModelInterface issueModel = Mockito.mock(IssueModelInterface.class);
    when(this.quizzesMapper.findByIssueId(issueModel.getId())).thenReturn(new ArrayList<>(0));
    final List<QuizModelInterface> quizzesFoundedModels = this.quizzesService.findByIssue(issueModel);
    Assert.assertEquals(0, quizzesFoundedModels.size());
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) IssueModelInterface(easytests.core.models.IssueModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with QuizModelInterface

use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.

the class QuizzesServiceTest method testDeleteWithOptions.

@Test
public void testDeleteWithOptions() throws Exception {
    final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
    final QuizzesOptionsInterface quizzesOptions = Mockito.mock(QuizzesOptionsInterface.class);
    this.quizzesService.delete(quizModel, quizzesOptions);
    verify(quizzesOptions).deleteWithRelations(quizModel);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) QuizzesOptionsInterface(easytests.core.options.QuizzesOptionsInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with QuizModelInterface

use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.

the class QuizzesServiceTest method testSaveCreatesEntity.

@Test
public void testSaveCreatesEntity() throws Exception {
    final QuizModelInterface quizModel = this.createQuizModel(null, "test", 1);
    this.quizzesService.save(quizModel);
    verify(this.quizzesMapper, times(1)).insert(this.mapQuizEntity(quizModel));
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with QuizModelInterface

use of easytests.core.models.QuizModelInterface in project easy-tests by malinink.

the class TesteesServiceTest method testFindByQuizPresentModel.

@Test
public void testFindByQuizPresentModel() throws Exception {
    final Integer quizId = 3;
    final TesteeEntity testeeEntity = Entities.createTesteeEntityMock(3, "FirstName", "LastName", "Surname", 301, quizId);
    given(this.testeesMapper.findByQuizId(quizId)).willReturn(testeeEntity);
    final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
    Mockito.when(quizModel.getId()).thenReturn(quizId);
    final TesteeModelInterface testeeModel = this.testeesService.findByQuiz(quizModel);
    Assert.assertNotNull(testeeModel);
    Assert.assertEquals(this.mapTesteeModel(testeeEntity), testeeModel);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) TesteeEntity(easytests.core.entities.TesteeEntity) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

QuizModelInterface (easytests.core.models.QuizModelInterface)48 Test (org.junit.Test)42 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)42 ArrayList (java.util.ArrayList)17 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)15 IssueModelInterface (easytests.core.models.IssueModelInterface)11 PointModelInterface (easytests.core.models.PointModelInterface)11 TesteeModelInterface (easytests.core.models.TesteeModelInterface)11 QuizzesOptionsInterface (easytests.core.options.QuizzesOptionsInterface)9 InOrder (org.mockito.InOrder)8 QuizEntity (easytests.core.entities.QuizEntity)7 PointsServiceInterface (easytests.core.services.PointsServiceInterface)7 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)7 IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)6 SolutionModelInterface (easytests.core.models.SolutionModelInterface)4 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)4 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)4 SolutionsServiceInterface (easytests.core.services.SolutionsServiceInterface)4 QuestionModelInterface (easytests.core.models.QuestionModelInterface)3 QuizModel (easytests.core.models.QuizModel)2