]> juplo.de Git - demos/kafka/chat/commitdiff
fix: ShardNotOwnedException must map to "503 - Service Unavailable"
authorKai Moritz <kai@juplo.de>
Wed, 20 Mar 2024 08:57:15 +0000 (09:57 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 25 Mar 2024 10:57:39 +0000 (11:57 +0100)
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java
src/test/java/de/juplo/kafka/chat/backend/AbstractConfigurationWithShardingIT.java
src/test/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerTest.java

index cdcee668d330099011c4ef65e4e24afcad376269..9a9cf90313a0fc1c0139f3d6b6028f94e473b49a 100644 (file)
@@ -57,7 +57,7 @@ public class ChatBackendControllerAdvice
       ServerWebExchange exchange,
       UriComponentsBuilder uriComponentsBuilder)
   {
-    final HttpStatus status = HttpStatus.NOT_FOUND;
+    final HttpStatus status = HttpStatus.SERVICE_UNAVAILABLE;
     ProblemDetail problem = ProblemDetail.forStatus(status);
 
     problem.setProperty("timestamp", new Date());
index 5c9ac13f5028c29798825fbd29c114a5bc4e6f5b..f8e475ce3ab0dad7a2414278c2a54362bbe0b6af 100644 (file)
@@ -33,7 +33,7 @@ public abstract class AbstractConfigurationWithShardingIT extends AbstractConfig
               .accept(MediaType.APPLICATION_JSON)
               .bodyValue("The devil rules route 66")
               .exchange()
-              .expectStatus().isNotFound()
+              .expectStatus().is5xxServerError()
               .expectBody()
               .jsonPath("$.type").value(endsWith("/problem/shard-not-owned"))
               .jsonPath("$.shard").isEqualTo(shard));
index 01de390c6b53deab10766227b8c468ba36d08615..0b365e2a5814aa318bd38cf22d2f1d26d5fbb422 100644 (file)
@@ -376,7 +376,7 @@ public class ChatBackendControllerTest
       int shard)
   {
     responseSpec
-        .expectStatus().isNotFound()
+        .expectStatus().is5xxServerError()
         .expectBody()
         .jsonPath("$.type").isEqualTo("/problem/shard-not-owned")
         .jsonPath("$.shard").isEqualTo(shard);