From 2dc6bac0fe439c09c3e4bd113784a95f8a3e33b8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 8 Jan 2023 16:09:30 +0100 Subject: [PATCH] refactor: Added assertj-reactor for more readability --- pom.xml | 7 +++++++ .../persistence/LocalJsonFilesStorageStrategyIT.java | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 29454358..4b240588 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ Simplified Chat-Service, that needs state on the server 17 + 1.0.8 @@ -43,6 +44,12 @@ spring-boot-starter-test test + + pl.rzrz + assertj-reactor + ${assertj-reactor.version} + test + diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java index 81778812..c7692228 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java @@ -18,7 +18,7 @@ import java.nio.file.Paths; import java.time.Clock; import java.util.List; -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; +import static pl.rzrz.assertj.reactor.Assertions.*; @Slf4j @@ -61,14 +61,20 @@ public class LocalJsonFilesStorageStrategyIT assertThat(chathome.list()).containsExactlyElementsOf(List.of(chatroom)); assertThat(chathome.getChatroom(chatroom.getId())).contains(chatroom); - assertThat(chathome.getChatroom(chatroom.getId()).get().getMessages().toStream()).containsExactlyElementsOf(List.of(m1, m2, m3, m4)); + assertThat(chathome + .getChatroom(chatroom.getId()) + .get() + .getMessages()).emitsExactly(m1, m2, m3, m4); stop(); start(); assertThat(chathome.list()).containsExactlyElementsOf(List.of(chatroom)); assertThat(chathome.getChatroom(chatroom.getId())).contains(chatroom); - assertThat(chathome.getChatroom(chatroom.getId()).get().getMessages().toStream()).containsExactlyElementsOf(List.of(m1, m2, m3, m4)); + assertThat(chathome + .getChatroom(chatroom.getId()) + .get() + .getMessages()).emitsExactly(m1, m2, m3, m4); } @BeforeEach -- 2.20.1