From d625dab8a9ec4a33db35a3b156e1f87aaf4eaa7e Mon Sep 17 00:00:00 2001 From: Oleksandr Vidinieiev Date: Fri, 26 Jan 2024 13:33:12 +0200 Subject: [PATCH] MODTLR-10 Extend EcsTlrApiTest --- src/test/java/org/folio/api/EcsTlrApiTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/folio/api/EcsTlrApiTest.java b/src/test/java/org/folio/api/EcsTlrApiTest.java index 094744e7..0aa3fecc 100644 --- a/src/test/java/org/folio/api/EcsTlrApiTest.java +++ b/src/test/java/org/folio/api/EcsTlrApiTest.java @@ -19,6 +19,7 @@ import java.util.UUID; import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; import static com.github.tomakehurst.wiremock.client.WireMock.jsonResponse; import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; @@ -64,18 +65,20 @@ void getByIdNotFound() throws Exception { @Test void titleLevelRequestIsCreatedForDifferentTenant() { EcsTlr ecsTlr = buildEcsTlr(); + String ecsTlrJson = asJsonString(ecsTlr); wireMockServer.stubFor(WireMock.post(urlMatching(".*/circulation/requests")) .withHeader(TENANT_HEADER, equalTo(ANOTHER_TENANT)) - .willReturn(jsonResponse(asJsonString(ecsTlr), HttpStatus.SC_CREATED))); + .willReturn(jsonResponse(ecsTlrJson, HttpStatus.SC_CREATED))); assertEquals(TENANT, getCurrentTenantId()); doPost(TLR_URL, ecsTlr) .expectStatus().isCreated() - .expectBody().json(asJsonString(ecsTlr)); + .expectBody().json(ecsTlrJson); assertEquals(TENANT, getCurrentTenantId()); wireMockServer.verify(postRequestedFor(urlMatching(".*/circulation/requests")) - .withHeader(TENANT_HEADER, equalTo(ANOTHER_TENANT))); + .withHeader(TENANT_HEADER, equalTo(ANOTHER_TENANT)) + .withRequestBody(equalToJson(ecsTlrJson))); } private String getCurrentTenantId() {