Search in sources :

Example 16 with ModelsListEmpty

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

the class UserModelTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer userId = 3;
    final String firstName = "FirstName";
    final String lastName = "LastName";
    final String surname = "Surname";
    final String email = "email";
    final String password = "password";
    final Boolean isAdmin = false;
    final Integer state = 2;
    final UserEntity userEntity = Entities.createUserEntityMock(userId, firstName, lastName, surname, email, password, isAdmin, state);
    final UserModel userModel = new UserModel();
    userModel.map(userEntity);
    Assert.assertEquals(userId, userModel.getId());
    Assert.assertEquals(firstName, userModel.getFirstName());
    Assert.assertEquals(lastName, userModel.getLastName());
    Assert.assertEquals(surname, userModel.getSurname());
    Assert.assertEquals(email, userModel.getEmail());
    Assert.assertEquals(password, userModel.getPassword());
    Assert.assertEquals(isAdmin, userModel.getIsAdmin());
    Assert.assertEquals(state, userModel.getState());
    Assert.assertEquals(new ModelsListEmpty(), userModel.getSubjects());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserEntity(easytests.core.entities.UserEntity) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 17 with ModelsListEmpty

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

the class SubjectEntityTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer subjectId = 5;
    final String subjectName = "Test subject";
    final Integer subjectUserId = 1;
    final SubjectModelInterface subjectModel = Mockito.mock(SubjectModelInterface.class);
    Mockito.when(subjectModel.getId()).thenReturn(subjectId);
    Mockito.when(subjectModel.getName()).thenReturn(subjectName);
    Mockito.when(subjectModel.getTopics()).thenReturn(new ModelsListEmpty());
    Mockito.when(subjectModel.getUser()).thenReturn(new UserModelEmpty(subjectUserId));
    Mockito.when(subjectModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty());
    Mockito.when(subjectModel.getIssues()).thenReturn(new ModelsListEmpty());
    final SubjectEntity subjectEntity = new SubjectEntity();
    subjectEntity.map(subjectModel);
    Assert.assertEquals(subjectId, subjectEntity.getId());
    Assert.assertEquals(subjectName, subjectEntity.getName());
    Assert.assertEquals(subjectUserId, subjectEntity.getUserId());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) SubjectModelInterface(easytests.core.models.SubjectModelInterface) Test(org.junit.Test)

Example 18 with ModelsListEmpty

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

the class IssueStandardSupport method getModelMock.

private IssueStandardModelInterface getModelMock(Integer id, Integer timeLimit, Integer questionsNumber, Integer subjectId) {
    final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
    Mockito.when(issueStandardModel.getId()).thenReturn(id);
    Mockito.when(issueStandardModel.getTimeLimit()).thenReturn(timeLimit);
    Mockito.when(issueStandardModel.getQuestionsNumber()).thenReturn(questionsNumber);
    Mockito.when(issueStandardModel.getTopicPriorities()).thenReturn(new ModelsListEmpty());
    Mockito.when(issueStandardModel.getQuestionTypeOptions()).thenReturn(new ModelsListEmpty());
    Mockito.when(issueStandardModel.getSubject()).thenReturn(new SubjectModelEmpty(subjectId));
    return issueStandardModel;
}
Also used : SubjectModelEmpty(easytests.core.models.empty.SubjectModelEmpty) IssueStandardModelInterface(easytests.core.models.IssueStandardModelInterface) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty)

Example 19 with ModelsListEmpty

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

the class QuestionsSupport method getModelMock.

private QuestionModelInterface getModelMock(Integer id, String text, Integer questionTypeId, Integer topicId) {
    final QuestionModelInterface questionModel = Mockito.mock(QuestionModelInterface.class);
    Mockito.when(questionModel.getId()).thenReturn(id);
    Mockito.when(questionModel.getText()).thenReturn(text);
    Mockito.when(questionModel.getQuestionType()).thenReturn(new QuestionTypeModelEmpty(questionTypeId));
    Mockito.when(questionModel.getTopic()).thenReturn(new TopicModelEmpty(topicId));
    Mockito.when(questionModel.getAnswers()).thenReturn(new ModelsListEmpty());
    return questionModel;
}
Also used : TopicModelEmpty(easytests.core.models.empty.TopicModelEmpty) QuestionModelInterface(easytests.core.models.QuestionModelInterface) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) QuestionTypeModelEmpty(easytests.core.models.empty.QuestionTypeModelEmpty)

Example 20 with ModelsListEmpty

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

the class QuizzesSupport method getModelMock.

private QuizModelInterface getModelMock(Integer id, Integer issueId, String inviteCode, Boolean codeExpired, LocalDateTime startedAt, LocalDateTime finishedAt) {
    final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
    Mockito.when(quizModel.getId()).thenReturn(id);
    Mockito.when(quizModel.getInviteCode()).thenReturn(inviteCode);
    Mockito.when(quizModel.getCodeExpired()).thenReturn(codeExpired);
    Mockito.when(quizModel.getStartedAt()).thenReturn(startedAt);
    Mockito.when(quizModel.getFinishedAt()).thenReturn(finishedAt);
    Mockito.when(quizModel.getIssue()).thenReturn(new IssueModelEmpty(issueId));
    Mockito.when(quizModel.getPoints()).thenReturn(new ModelsListEmpty());
    Mockito.when(quizModel.getTestee()).thenReturn(new TesteeModelEmpty());
    return quizModel;
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) TesteeModelEmpty(easytests.core.models.empty.TesteeModelEmpty) IssueModelEmpty(easytests.core.models.empty.IssueModelEmpty)

Aggregations

ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)36 Test (org.junit.Test)13 SubjectModelEmpty (easytests.core.models.empty.SubjectModelEmpty)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)7 UserModelEmpty (easytests.core.models.empty.UserModelEmpty)7 QuestionTypeModelEmpty (easytests.core.models.empty.QuestionTypeModelEmpty)5 TopicModelEmpty (easytests.core.models.empty.TopicModelEmpty)5 IssueStandardModelInterface (easytests.core.models.IssueStandardModelInterface)4 SubjectModelInterface (easytests.core.models.SubjectModelInterface)4 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)3 QuestionModelEmpty (easytests.core.models.empty.QuestionModelEmpty)3 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)3 TesteeModelEmpty (easytests.core.models.empty.TesteeModelEmpty)3 IssueStandardQuestionTypeOptionModelInterface (easytests.core.models.IssueStandardQuestionTypeOptionModelInterface)2 IssueStandardTopicPriorityModelInterface (easytests.core.models.IssueStandardTopicPriorityModelInterface)2 IssueStandardQuestionTypeOptionsServiceInterface (easytests.core.services.IssueStandardQuestionTypeOptionsServiceInterface)2 IssueStandardTopicPrioritiesServiceInterface (easytests.core.services.IssueStandardTopicPrioritiesServiceInterface)2 SubjectsServiceInterface (easytests.core.services.SubjectsServiceInterface)2 ArrayList (java.util.ArrayList)2