Search in sources :

Example 6 with TesteeModelInterface

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

the class TesteesServiceTest method testFindByQuizAbsentModel.

@Test
public void testFindByQuizAbsentModel() throws Exception {
    final Integer quizId = 5;
    given(this.testeesMapper.findByQuizId(quizId)).willReturn(null);
    final QuizModelInterface quizModel = Mockito.mock(QuizModelInterface.class);
    Mockito.when(quizModel.getId()).thenReturn(quizId);
    final TesteeModelInterface testeeModel = this.testeesService.findByQuiz(quizModel);
    Assert.assertNull(testeeModel);
}
Also used : QuizModelInterface(easytests.core.models.QuizModelInterface) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with TesteeModelInterface

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

the class TesteesServiceTest method testDeleteUnidentifiedModel.

@Test
public void testDeleteUnidentifiedModel() throws Exception {
    final TesteeModelInterface testeeModel = Models.createTesteeModel(null, "FirstName", "LastName", "Surname", 301, 1);
    exception.expect(DeleteUnidentifiedModelException.class);
    this.testeesService.delete(testeeModel);
}
Also used : TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 8 with TesteeModelInterface

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

the class TesteesServiceTest method testFindAbsentModel.

@Test
public void testFindAbsentModel() throws Exception {
    final Integer id = 10;
    final TesteeModelInterface testeeModel = this.testeesService.find(id);
    Assert.assertEquals(null, testeeModel);
}
Also used : TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with TesteeModelInterface

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

the class TesteeEntityTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer testeeId = 3;
    final String firstName = "FirstName";
    final String lastName = "LastName";
    final String surname = "Surname";
    final Integer groupNumber = 307;
    final Integer quizId = 3;
    final TesteeModelInterface testeeModel = Mockito.mock(TesteeModelInterface.class);
    Mockito.when(testeeModel.getId()).thenReturn(testeeId);
    Mockito.when(testeeModel.getFirstName()).thenReturn(firstName);
    Mockito.when(testeeModel.getLastName()).thenReturn(lastName);
    Mockito.when(testeeModel.getSurname()).thenReturn(surname);
    Mockito.when(testeeModel.getGroupNumber()).thenReturn(groupNumber);
    Mockito.when(testeeModel.getQuiz()).thenReturn(new QuizModelEmpty(quizId));
    final TesteeEntity testeeEntity = new TesteeEntity();
    testeeEntity.map(testeeModel);
    Assert.assertEquals(testeeId, testeeEntity.getId());
    Assert.assertEquals(firstName, testeeEntity.getFirstName());
    Assert.assertEquals(lastName, testeeEntity.getLastName());
    Assert.assertEquals(surname, testeeEntity.getSurname());
    Assert.assertEquals(groupNumber, testeeEntity.getGroupNumber());
    Assert.assertEquals(quizId, testeeEntity.getQuizId());
}
Also used : QuizModelEmpty(easytests.core.models.empty.QuizModelEmpty) TesteeModelInterface(easytests.core.models.TesteeModelInterface) Test(org.junit.Test)

Example 10 with TesteeModelInterface

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

the class TesteesService method map.

private TesteeModelInterface map(TesteeEntity testeeEntity) {
    if (testeeEntity == null) {
        return null;
    }
    final TesteeModelInterface testeeModel = new TesteeModel();
    testeeModel.map(testeeEntity);
    return testeeModel;
}
Also used : TesteeModelInterface(easytests.core.models.TesteeModelInterface) TesteeModel(easytests.core.models.TesteeModel)

Aggregations

TesteeModelInterface (easytests.core.models.TesteeModelInterface)33 Test (org.junit.Test)28 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)27 QuizModelInterface (easytests.core.models.QuizModelInterface)11 QuizzesServiceInterface (easytests.core.services.QuizzesServiceInterface)7 TesteeEntity (easytests.core.entities.TesteeEntity)6 TesteesServiceInterface (easytests.core.services.TesteesServiceInterface)6 TesteesOptionsInterface (easytests.core.options.TesteesOptionsInterface)5 ArrayList (java.util.ArrayList)5 PointModelInterface (easytests.core.models.PointModelInterface)4 QuizModelEmpty (easytests.core.models.empty.QuizModelEmpty)4 PointsServiceInterface (easytests.core.services.PointsServiceInterface)4 InOrder (org.mockito.InOrder)4 IssueModelInterface (easytests.core.models.IssueModelInterface)2 TesteeModel (easytests.core.models.TesteeModel)2 IssueModelEmpty (easytests.core.models.empty.IssueModelEmpty)2 IssuesServiceInterface (easytests.core.services.IssuesServiceInterface)2 QuizzesOptions (easytests.core.options.QuizzesOptions)1 TesteesOptions (easytests.core.options.TesteesOptions)1