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>
Wed, 23 Aug 2023 05:36:50 +0000 (07:36 +0200)
commit8837fa6b1caed563ef8fb1929e8d66609477153c
tree584de5fede478a211cdffb41e93cd9a79d72f1ad
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