refactor: Added assertj-reactor for more readability
authorKai Moritz <kai@juplo.de>
Sun, 8 Jan 2023 15:09:30 +0000 (16:09 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 15 Jan 2023 18:37:00 +0000 (19:37 +0100)
pom.xml
src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java

diff --git a/pom.xml b/pom.xml
index 2945435..4b24058 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,7 @@
   <description>Simplified Chat-Service, that needs state on the server</description>
   <properties>
     <java.version>17</java.version>
+    <assertj-reactor.version>1.0.8</assertj-reactor.version>
   </properties>
   <dependencies>
     <dependency>
       <artifactId>spring-boot-starter-test</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>pl.rzrz</groupId>
+      <artifactId>assertj-reactor</artifactId>
+      <version>${assertj-reactor.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
index 8177881..c769222 100644 (file)
@@ -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