Skip to content

Commit

Permalink
CIRC-2100 Return 204 for post api and fixing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh-kalyanasundaram committed Jul 31, 2024
1 parent e3644c8 commit 140a354
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.folio.circulation.infrastructure.storage.requests.RequestRepository;
import org.folio.circulation.support.Clients;
import org.folio.circulation.support.RouteRegistration;
import org.folio.circulation.support.http.server.JsonHttpResponse;
import org.folio.circulation.support.http.server.NoContentResponse;
import org.folio.circulation.support.http.server.WebContext;
import org.folio.circulation.support.results.Result;

Expand All @@ -24,6 +24,7 @@

import static org.folio.circulation.support.ValidationErrorFailure.singleValidationError;
import static org.folio.circulation.support.json.JsonPropertyFetcher.getProperty;
import static org.folio.circulation.support.results.MappingFunctions.toFixedValue;
import static org.folio.circulation.support.results.Result.ofAsync;
import static org.folio.circulation.support.results.Result.succeeded;

Expand Down Expand Up @@ -61,7 +62,7 @@ void create(RoutingContext routingContext) {
.thenCompose(r -> r.after(validatePrintEventFeatureFlag(circulationSettingsRepository)))
.thenCompose(r -> r.after(validateRequests(requestRepository)))
.thenCompose(r -> r.after(printEventsRepository::create))
.thenApply(r -> r.map(response -> JsonHttpResponse.created(null, null)))
.thenApply(r -> r.map(toFixedValue(NoContentResponse::noContent)))
.thenAccept(context::writeResultToHttpResponse);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/api/printEvents/PrintEventsTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static api.support.http.InterfaceUrls.printEventsUrl;
import static api.support.matchers.ResponseStatusCodeMatcher.hasStatus;
import static org.folio.HttpStatus.HTTP_CREATED;
import static org.folio.HttpStatus.HTTP_NO_CONTENT;
import static org.folio.HttpStatus.HTTP_UNPROCESSABLE_ENTITY;
import static org.hamcrest.MatcherAssert.assertThat;

Expand All @@ -29,7 +29,7 @@ void postPrintEventsTest() {
JsonObject printRequest = getPrintEvent();
printRequest.put("requestIds", createOneHundredRequests());
Response response = restAssuredClient.post(printRequest, printEventsUrl("/print-events-entry"), "post-print-event");
assertThat(response, hasStatus(HTTP_CREATED));
assertThat(response, hasStatus(HTTP_NO_CONTENT));
}

@Test
Expand Down

0 comments on commit 140a354

Please sign in to comment.