Search in sources :

Example 1 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testSaveModelsListWithOptions.

@Test
public void testSaveModelsListWithOptions() throws Exception {
    final ArgumentCaptor<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModelCaptor = ArgumentCaptor.forClass(IssueStandardQuestionTypeOptionModelInterface.class);
    final List<IssueStandardQuestionTypeOptionModelInterface> questionTypeOptionModels = this.getQuestionTypeOptionFixturesModels();
    final IssueStandardQuestionTypeOptionsOptionsInterface questionTypeOptionsOptions = Mockito.mock(IssueStandardQuestionTypeOptionsOptionsInterface.class);
    this.questionTypeOptionsService.save(questionTypeOptionModels, questionTypeOptionsOptions);
    this.assertServicesSet(questionTypeOptionsOptions, questionTypeOptionModels.size());
    verify(questionTypeOptionsOptions, times(questionTypeOptionModels.size())).saveWithRelations(questionTypeOptionModelCaptor.capture());
    this.questionTypeOptionsSupport.assertModelsListEquals(questionTypeOptionModels, questionTypeOptionModelCaptor.getAllValues());
    verifyNoMoreInteractions(this.questionTypeOptionsMapper);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardQuestionTypeOptionsOptionsInterface(easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface)

Example 2 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsSupport method assertModelsListEquals.

public void assertModelsListEquals(List<IssueStandardQuestionTypeOptionModelInterface> expected, List<IssueStandardQuestionTypeOptionModelInterface> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    Integer i = 0;
    for (IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel : expected) {
        this.assertEquals(questionTypeOptionModel, actual.get(i));
        i++;
    }
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)

Example 3 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testSaveUpdatesModel.

@Test
public void testSaveUpdatesModel() throws Exception {
    final Integer id = 1;
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = Models.createQuestionTypeOptionModel(id, 1, 10, 20, 300, 1);
    Assert.assertNotEquals(questionTypeOptionModel, this.questionTypeOptionsService.find(id));
    this.questionTypeOptionsService.save(questionTypeOptionModel);
    Assert.assertEquals(questionTypeOptionModel, this.questionTypeOptionsService.find(id));
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindWithOptions.

@Test
public void testFindWithOptions() throws Exception {
    final Integer id = 1;
    final Integer issueStandardId = 1;
    final IssueStandardQuestionTypeOptionModelInterface questionTypeOptionModel = Models.createQuestionTypeOptionModel(id, 1, 1, null, null, issueStandardId);
    final IssueStandardModelInterface issueStandardModel = Models.createIssueStandardModel(issueStandardId, 300, 30, 1);
    questionTypeOptionModel.setIssueStandard(issueStandardModel);
    final IssueStandardQuestionTypeOptionModelInterface foundedQuestionTypeOptionModel = this.questionTypeOptionsService.find(id, new IssueStandardQuestionTypeOptionsOptions().withIssueStandard(new IssueStandardsOptions()));
    Assert.assertEquals(questionTypeOptionModel, foundedQuestionTypeOptionModel);
    Assert.assertEquals(issueStandardModel, foundedQuestionTypeOptionModel.getIssueStandard());
}
Also used : IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) IssueStandardQuestionTypeOptionsOptions(easytests.core.options.IssueStandardQuestionTypeOptionsOptions) IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) IssueStandardsOptions(easytests.core.options.IssueStandardsOptions) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 5 with IssueStandardQuestionTypeOptionModelInterface

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

the class IssueStandardQuestionTypeOptionsServiceTest method testFindAbsentModel.

@Test
public void testFindAbsentModel() throws Exception {
    final Integer id = 10;
    final IssueStandardQuestionTypeOptionModelInterface foundedQuestionTypeOptionModel = this.questionTypeOptionsService.find(id);
    Assert.assertNull(foundedQuestionTypeOptionModel);
}
Also used : IssueStandardQuestionTypeOptionModelInterface(easytests.core.models.IssueStandardQuestionTypeOptionModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)39 Test (org.junit.Test)30 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)29 IssueStandardQuestionTypeOptionEntity (easytests.core.entities.IssueStandardQuestionTypeOptionEntity)9 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)9 IssueStandardQuestionTypeOptionsOptionsInterface (easytests.core.options.IssueStandardQuestionTypeOptionsOptionsInterface)9 ArrayList (java.util.ArrayList)7 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)5 IssueStandardsServiceInterface (easytests.core.services.IssueStandardsServiceInterface)5 QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)4 IssueStandardQuestionTypeOptionsServiceInterface (easytests.core.services.IssueStandardQuestionTypeOptionsServiceInterface)4 QuestionTypesServiceInterface (easytests.core.services.QuestionTypesServiceInterface)3 IssueStandardQuestionTypeOptionModel (easytests.core.models.IssueStandardQuestionTypeOptionModel)2 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)2 QuestionTypeModelInterface (easytests.core.models.QuestionTypeModelInterface)2 SubjectModelInterface (easytests.core.models.SubjectModelInterface)2 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)2 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)2 IssueStandardTopicPrioritiesServiceInterface (easytests.core.services.IssueStandardTopicPrioritiesServiceInterface)2 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)2