test: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored
authorKai Moritz <kai@juplo.de>
Sun, 8 Jan 2023 11:28:32 +0000 (12:28 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 9 Jan 2023 19:57:47 +0000 (20:57 +0100)
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java
src/test/java/de/juplo/kafka/chat/backend/persistence/LocalJsonFilesStorageStrategyIT.java

index 63b5b36..22eebff 100644 (file)
@@ -1,6 +1,8 @@
 package de.juplo.kafka.chat.backend.domain;
 
+import lombok.EqualsAndHashCode;
 import lombok.Getter;
+import lombok.ToString;
 import lombok.extern.slf4j.Slf4j;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
@@ -12,6 +14,8 @@ import java.util.*;
 
 
 @Slf4j
+@EqualsAndHashCode(of = { "id" })
+@ToString(of = { "id", "name" })
 public class ChatRoom
 {
   @Getter
index d136fa9..8177881 100644 (file)
@@ -64,6 +64,11 @@ public class LocalJsonFilesStorageStrategyIT
     assertThat(chathome.getChatroom(chatroom.getId()).get().getMessages().toStream()).containsExactlyElementsOf(List.of(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));
   }
 
   @BeforeEach