X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Fkafka%2Fchat%2Fbackend%2FAbstractStorageStrategyIT.java;h=7c9c07c36abdbca43f5866ac018d29c833efdc01;hb=ed777a6fb33ffc8b2cdb6cf7df9cce51c39d44da;hp=9568545a459ba8be3806868022dc47de10dd5321;hpb=47d4a54aaa1ce13180ab6fdad0569cf2d0851563;p=demos%2Fkafka%2Fchat diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java index 9568545a..7c9c07c3 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractStorageStrategyIT.java @@ -28,19 +28,15 @@ import static pl.rzrz.assertj.reactor.Assertions.*; @Slf4j public abstract class AbstractStorageStrategyIT { + @Autowired ChatHomeService chathome; - @Autowired StorageStrategy storageStrategy; - abstract ChatHomeService getChatHome(); - protected void start() - { - chathome = getChatHome(); - } + abstract void restore(); - protected void stop() + void store() { storageStrategy .write(chathome) @@ -48,9 +44,9 @@ public abstract class AbstractStorageStrategyIT } @Test - protected void testStoreAndRecreate() + void testStoreAndRecreate() { - start(); + restore(); assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0); @@ -69,8 +65,8 @@ public abstract class AbstractStorageStrategyIT .getChatRoomData(chatRoomId) .flatMapMany(cr -> cr.getMessages())).emitsExactly(m1, m2, m3, m4); - stop(); - start(); + store(); + restore(); assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyElementsOf(List.of(info)); assertThat(chathome.getChatRoomInfo(chatRoomId)).emitsExactly(info); @@ -80,9 +76,9 @@ public abstract class AbstractStorageStrategyIT } @Test - protected void testStoreAndRecreateParallelChatRooms() + void testStoreAndRecreateParallelChatRooms() { - start(); + restore(); assertThat(chathome.getChatRoomInfo().toStream()).hasSize(0); @@ -114,8 +110,8 @@ public abstract class AbstractStorageStrategyIT .getChatRoomData(chatRoomBId) .flatMapMany(cr -> cr.getMessages())).emitsExactly(mb1, mb2, mb3, mb4); - stop(); - start(); + store(); + restore(); assertThat(chathome.getChatRoomInfo().toStream()).containsExactlyInAnyOrderElementsOf(List.of(infoA, infoB)); assertThat(chathome.getChatRoomInfo(chatRoomAId)).emitsExactly(infoA);