fix: GREEN - Fixed NPE in `ShardedChatHome.getChatRoom()` for foreign shard
authorKai Moritz <kai@juplo.de>
Fri, 18 Aug 2023 12:09:02 +0000 (14:09 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 20 Aug 2023 11:37:40 +0000 (13:37 +0200)
commit60cc6fc79211adbd92a147d8b9eb99f6908b7fcf
tree55b3a2bad69a35a1f1a13896f5ed9ac302bbbe6c
parent412635e46c4891f9565f341044878190c5674729
fix: GREEN - Fixed NPE in `ShardedChatHome.getChatRoom()` for foreign shard

* `ShardedChatHome.getChatRoom(UUID)` know checks, if a `ChatHome` exists
  for the selected shard.
* If no `ChatHome` exists, a `ShardNotOwnedException` is thrown.
* The `ChatBackendControllerAdvice` translates the exception to an error
  of type 404 - NOT FOUND, to fullfill the defined expectations.
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java
src/main/java/de/juplo/kafka/chat/backend/domain/ShardNotOwnedException.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/chat/backend/domain/ShardedChatHome.java
src/test/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerTest.java