From: Kai Moritz Date: Sun, 8 Jan 2023 15:09:30 +0000 (+0100) Subject: refactor: Added assertj-reactor for more readability X-Git-Tag: wip~63 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2dc6bac0fe439c09c3e4bd113784a95f8a3e33b8;p=demos%2Fkafka%2Fchat refactor: Added assertj-reactor for more readability --- 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