diff --git a/src/test/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeRetryIntegrationTest.java b/src/test/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeRetryIntegrationTest.java index 9b55b8e8..e5854981 100644 --- a/src/test/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeRetryIntegrationTest.java +++ b/src/test/java/it/gov/pagopa/common/reactive/mongo/retry/MongoRequestRateTooLargeRetryIntegrationTest.java @@ -63,6 +63,7 @@ @WebFluxTest class MongoRequestRateTooLargeRetryIntegrationTest { + public static final String EXPECTED_TOO_MANY_REQUESTS_ERROR = "{\"code\":\"TOO_MANY_REQUESTS\",\"message\":\"Too Many Requests\"}"; @Value("${mongo.request-rate-too-large.batch.max-retry:3}") private int maxRetry; @Value("${mongo.request-rate-too-large.batch.max-millis-elapsed:0}") @@ -177,7 +178,7 @@ void testController_MonoMethod() { .uri(uriBuilder -> uriBuilder.path("/testMono").build()) .exchange() .expectStatus().isEqualTo(HttpStatus.TOO_MANY_REQUESTS) - .expectBody().json("{\"code\":\"TOO_MANY_REQUESTS\",\"message\":\"TOO_MANY_REQUESTS\"}"); + .expectBody().json(EXPECTED_TOO_MANY_REQUESTS_ERROR); Assertions.assertEquals(1, counter[0]); } @@ -188,7 +189,7 @@ void testController_MonoMethodRetryable() { .uri(uriBuilder -> uriBuilder.path("/testMonoRetryable").build()) .exchange() .expectStatus().isEqualTo(HttpStatus.TOO_MANY_REQUESTS) - .expectBody().json("{\"code\":\"TOO_MANY_REQUESTS\",\"message\":\"TOO_MANY_REQUESTS\"}"); + .expectBody().json(EXPECTED_TOO_MANY_REQUESTS_ERROR); Assertions.assertEquals(API_RETRYABLE_MAX_RETRY + 1, counter[0]); } @@ -199,7 +200,7 @@ void testController_FluxMethod() { .uri(uriBuilder -> uriBuilder.path("/testFlux").build()) .exchange() .expectStatus().isEqualTo(HttpStatus.TOO_MANY_REQUESTS) - .expectBody().json("{\"code\":\"TOO_MANY_REQUESTS\",\"message\":\"TOO_MANY_REQUESTS\"}"); + .expectBody().json(EXPECTED_TOO_MANY_REQUESTS_ERROR); Assertions.assertEquals(1, counter[0]); } @@ -210,7 +211,7 @@ void testController_FluxMethodRetryable() { .uri(uriBuilder -> uriBuilder.path("/testFluxRetryable").build()) .exchange() .expectStatus().isEqualTo(HttpStatus.TOO_MANY_REQUESTS) - .expectBody().json("{\"code\":\"TOO_MANY_REQUESTS\",\"message\":\"TOO_MANY_REQUESTS\"}"); + .expectBody().json(EXPECTED_TOO_MANY_REQUESTS_ERROR); Assertions.assertEquals(API_RETRYABLE_MAX_RETRY + 1, counter[0]); }