From: Kai Moritz Date: Sun, 8 Jan 2023 11:28:32 +0000 (+0100) Subject: test: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored X-Git-Tag: TEST~34 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=91cd85294c4595c1d1212527ac956244b6487ce2;p=demos%2Fkafka%2Fchat test: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java index 63b5b363..22eebffd 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java @@ -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 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 d136fa91..81778812 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 @@ -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