1 package de.juplo.kafka.chat.backend.domain;
3 import org.junit.jupiter.api.DisplayName;
4 import org.junit.jupiter.api.Test;
5 import reactor.core.publisher.Mono;
9 import static pl.rzrz.assertj.reactor.Assertions.assertThat;
12 public class ChatHomeWithShardsTestBase extends ChatHomeTestBase
14 public static final int NUM_SHARDS = 10;
15 public static final int OWNED_SHARD = 2;
16 public static final int NOT_OWNED_SHARD = 0;
20 @DisplayName("Assert ShardNotOwnedException is thrown, if the shard for the chatroom is not owned")
21 void testGetChatroomForNotOwnedShard()
24 UUID chatRoomId = UUID.fromString("4e7246a6-29ae-43ea-b56f-669c3481ac19");
27 Mono<ChatRoom> mono = chatHome.getChatRoom(chatRoomId);
30 assertThat(mono).sendsError(e ->
32 assertThat(e).isInstanceOf(ShardNotOwnedException.class);
33 ShardNotOwnedException shardNotOwnedException = (ShardNotOwnedException) e;
34 assertThat(shardNotOwnedException.getShard()).isEqualTo(NOT_OWNED_SHARD);