Commit f57a6740 authored by henrik.prangel's avatar henrik.prangel
Browse files

JUT-76 Refactor failing test

parent 525f8c8e
......@@ -198,13 +198,14 @@ public class ChatResourceIT {
.created(UPDATED_CREATED)
.updated(UPDATED_UPDATED)
.deleted(UPDATED_DELETED);
Instant updateTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
ChatDTO chatDTO = chatMapper.toDto(updatedChat);
Instant preUpdateTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
restChatMockMvc.perform(put("/api/chats")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(chatDTO)))
.andExpect(status().isOk());
Instant postUpdateTime = Instant.now().truncatedTo(ChronoUnit.SECONDS);
// Validate the Chat in the database
List<Chat> chatList = chatRepository.findAll();
......@@ -212,7 +213,8 @@ public class ChatResourceIT {
Chat testChat = chatList.get(chatList.size() - 1);
assertThat(testChat.getTopic()).isEqualTo(UPDATED_TOPIC);
assertThat(testChat.getCreated()).isEqualTo(UPDATED_CREATED);
assertThat(testChat.getUpdated()).isEqualTo(updateTime);
assertThat(testChat.getUpdated()).isBeforeOrEqualTo(postUpdateTime);
assertThat(testChat.getUpdated()).isAfterOrEqualTo(preUpdateTime);
assertThat(testChat.getDeleted()).isEqualTo(UPDATED_DELETED);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment