Search in sources :

Example 1 with TesteeModelEmpty

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

the class QuizModelTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer quizId = 5;
    final String quizInviteCode = "Test code";
    final LocalDateTime quizStartedAt = LocalDateTime.of(2000, 1, 1, 1, 1, 1);
    final LocalDateTime quizFinishedAt = LocalDateTime.of(2001, 1, 1, 1, 1, 1);
    final Boolean quizCodeExpired = false;
    final Integer quizIssueId = 3;
    final QuizEntity quizEntity = Mockito.mock(QuizEntity.class);
    Mockito.when(quizEntity.getId()).thenReturn(quizId);
    Mockito.when(quizEntity.getInviteCode()).thenReturn(quizInviteCode);
    Mockito.when(quizEntity.getStartedAt()).thenReturn(quizStartedAt);
    Mockito.when(quizEntity.getFinishedAt()).thenReturn(quizFinishedAt);
    Mockito.when(quizEntity.getCodeExpired()).thenReturn(quizCodeExpired);
    Mockito.when(quizEntity.getIssueId()).thenReturn(quizIssueId);
    final QuizModelInterface quizModel = new QuizModel();
    quizModel.map(quizEntity);
    Assert.assertEquals(quizId, quizModel.getId());
    Assert.assertEquals(quizStartedAt, quizModel.getStartedAt());
    Assert.assertEquals(quizFinishedAt, quizModel.getFinishedAt());
    Assert.assertEquals(quizCodeExpired, quizModel.getCodeExpired());
    Assert.assertEquals(new ModelsListEmpty(), quizModel.getPoints());
    Assert.assertEquals(new IssueModelEmpty(quizIssueId), quizModel.getIssue());
    Assert.assertEquals(new TesteeModelEmpty(), quizModel.getTestee());
}
Also used : LocalDateTime(java.time.LocalDateTime) QuizEntity(easytests.core.entities.QuizEntity) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) TesteeModelEmpty(easytests.core.models.empty.TesteeModelEmpty) IssueModelEmpty(easytests.core.models.empty.IssueModelEmpty) Test(org.junit.Test)

Example 2 with TesteeModelEmpty

use of easytests.core.models.empty.TesteeModelEmpty 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)

Example 3 with TesteeModelEmpty

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

the class QuizModel method map.

public void map(QuizEntity quizEntity) {
    this.setId(quizEntity.getId());
    this.setCodeExpired(quizEntity.getCodeExpired());
    this.setStartedAt(quizEntity.getStartedAt());
    this.setFinishedAt(quizEntity.getFinishedAt());
    this.setIssue(new IssueModelEmpty(quizEntity.getIssueId()));
    this.setInviteCode(quizEntity.getInviteCode());
    this.setPoints(new ModelsListEmpty());
    this.setTestee(new TesteeModelEmpty());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) TesteeModelEmpty(easytests.core.models.empty.TesteeModelEmpty) IssueModelEmpty(easytests.core.models.empty.IssueModelEmpty)

Aggregations

IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)3 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)3 TesteeModelEmpty (easytests.core.models.empty.TesteeModelEmpty)3 QuizEntity (easytests.core.entities.QuizEntity)1 QuizModelInterface (easytests.core.models.QuizModelInterface)1 LocalDateTime (java.time.LocalDateTime)1 Test (org.junit.Test)1