Search in sources :

Example 21 with TopicEntity

use of easytests.core.entities.TopicEntity in project easy-tests by malinink.

the class TopicsMapperTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    final Integer id = 1;
    final String name = "NewName";
    final Integer subjectId = 5;
    TopicEntity topicEntity = this.topicsMapper.find(id);
    Assert.assertNotNull(topicEntity);
    Assert.assertEquals(id, topicEntity.getId());
    Assert.assertNotEquals(name, topicEntity.getName());
    Assert.assertNotEquals(subjectId, topicEntity.getSubjectId());
    topicEntity = Mockito.mock(TopicEntity.class);
    Mockito.when(topicEntity.getId()).thenReturn(id);
    Mockito.when(topicEntity.getName()).thenReturn(name);
    Mockito.when(topicEntity.getSubjectId()).thenReturn(subjectId);
    this.topicsMapper.update(topicEntity);
    topicEntity = this.topicsMapper.find(id);
    Assert.assertEquals(id, topicEntity.getId());
    Assert.assertEquals(name, topicEntity.getName());
    Assert.assertEquals(subjectId, topicEntity.getSubjectId());
}
Also used : TopicEntity(easytests.core.entities.TopicEntity) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TopicEntity (easytests.core.entities.TopicEntity)21 Test (org.junit.Test)15 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)12 TopicModelInterface (easytests.core.models.TopicModelInterface)8 SubjectModelInterface (easytests.core.models.SubjectModelInterface)4 TopicsOptionsInterface (easytests.core.options.TopicsOptionsInterface)4 ArrayList (java.util.ArrayList)4 List (java.util.List)2 DeleteUnidentifiedModelException (easytests.core.services.exceptions.DeleteUnidentifiedModelException)1