Skip to content

Commit

Permalink
CIRC-2138: addded test case for 5XX case
Browse files Browse the repository at this point in the history
  • Loading branch information
kapil-epam committed Sep 23, 2024
1 parent 6cdb47d commit 2a7598c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/folio/service/PrintEventsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
public class PrintEventsService {

private static final Logger LOG = LoggerFactory.getLogger(PrintEventsService.class);
private final Context vertxContext;
private final Map<String, String> okapiHeaders;
private final PostgresClient postgresClient;

Expand Down Expand Up @@ -85,7 +84,6 @@ WITH print_counts AS (


public PrintEventsService(Context vertxContext, Map<String, String> okapiHeaders) {
this.vertxContext = vertxContext;
this.okapiHeaders = okapiHeaders;
this.postgresClient = PgUtil.postgresClient(vertxContext, okapiHeaders);
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/org/folio/rest/api/PrintEventsAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static org.folio.rest.support.http.InterfaceUrls.printEventsUrl;
import static org.folio.rest.support.matchers.HttpResponseStatusCodeMatchers.isCreated;
import static org.folio.rest.support.matchers.HttpResponseStatusCodeMatchers.isInternalServerError;
import static org.folio.rest.support.matchers.HttpResponseStatusCodeMatchers.isOk;
import static org.folio.rest.support.matchers.HttpResponseStatusCodeMatchers.isUnprocessableEntity;
import static org.hamcrest.core.Is.is;
Expand Down Expand Up @@ -180,6 +181,18 @@ public void getPrintEventStatusWithInvalidRequestIds() throws MalformedURLExcept
assertThat(jsonObject.getJsonArray("printEventsStatusResponses").size(), is(0));
}

@Test
public void createPrintEventLogAndValidate5XX() throws MalformedURLException,
ExecutionException, InterruptedException {
JsonObject printEventsJson = getPrintEvent();
final CompletableFuture<JsonResponse> postCompleted = new CompletableFuture<>();
client.post(printEventsUrl("/print-events-entry"), printEventsJson,
"INVALID_TENANT_ID",
ResponseHandler.json(postCompleted));
final JsonResponse postResponse = postCompleted.get();
assertThat(postResponse, isInternalServerError());
}

private JsonObject getPrintEvent() {
List<String> requestIds = List.of("5f5751b4-e352-4121-adca-204b0c2aec43", "5f5751b4-e352-4121-adca-204b0c2aec44");
return new JsonObject()
Expand Down

0 comments on commit 2a7598c

Please sign in to comment.