From 084a922c47f5ecacc7e86c03abd5155fa3255440 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 8 Jan 2023 12:28:32 +0100 Subject: [PATCH] test: `LocalJsonFilesStorageStrategyIT` asserts, that the state is restored --- .../java/de/juplo/kafka/chat/backend/domain/ChatRoom.java | 4 ++++ .../backend/persistence/LocalJsonFilesStorageStrategyIT.java | 5 +++++ 2 files changed, 9 insertions(+) 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 -- 2.20.1