refactor: Moved business-logic from `ChatRoomService` into `ChatRoom`
authorKai Moritz <kai@juplo.de>
Sun, 8 Jan 2023 20:30:57 +0000 (21:30 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 15 Jan 2023 18:37:26 +0000 (19:37 +0100)
commit972a1f2c248a51740091c1fdf3526f0eb676639e
tree5d3c28a3de3657510b34da57f7140a3ec827ec2f
parent0e6fd57b277df31ef319f47c63bc182694e46082
refactor: Moved business-logic from `ChatRoomService` into `ChatRoom`

- Some essential business-logic -- the identification of mutated messages --
  was buried in `InMemoryChatRoomService`.
- This business-logic was moved into `ChatRoom`, becaus otherwise, it
  would have been necessary, to reproduce this logic in each and every
  new implementation of `ChatRoomService`, which would have been exhausting
  and errorprone.
- This allowed also cleaner code in `InMemoryChatRoomService`, that
  can focus on the persistence-logic.
- The implementation of `MessageMutationException` and the look of the
  accompanying problem-details hat to be refined accordingly.
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/ChatRoom.java
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomService.java
src/main/java/de/juplo/kafka/chat/backend/domain/MessageMutationException.java
src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatRoomService.java
src/test/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerTest.java
src/test/java/de/juplo/kafka/chat/backend/domain/ChatRoomTest.java [new file with mode: 0644]