Skip to content

Commit

Permalink
fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio.torre committed Dec 18, 2023
1 parent 64552df commit 5de2c52
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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]);
}
Expand All @@ -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]);
}
Expand All @@ -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]);
}
Expand All @@ -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]);
}
Expand Down

0 comments on commit 5de2c52

Please sign in to comment.