From 48291d3d43d51c676f8b0b3979279a2ba34d9bea 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 ca5c7c5d..97eceffb 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