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());
}
Aggregations