From c74b76fb68c7700a067374c22f7390e209b94170 Mon Sep 17 00:00:00 2001 From: Khamidulla Abdulkhakimov Date: Mon, 13 Nov 2023 18:21:01 +0500 Subject: [PATCH] [MODORDSTOR-356] - Increased coverage --- src/test/java/org/folio/rest/impl/PieceApiTest.java | 5 ++++- .../pieces/flows/update/PieceUpdateFlowManagerTest.java | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/folio/rest/impl/PieceApiTest.java b/src/test/java/org/folio/rest/impl/PieceApiTest.java index f015a2eae..3018ef49a 100644 --- a/src/test/java/org/folio/rest/impl/PieceApiTest.java +++ b/src/test/java/org/folio/rest/impl/PieceApiTest.java @@ -152,7 +152,10 @@ void testPutPiecesByIdTest() throws Exception { pieceRequest.put("receivingStatus", "Received"); addMockEntry(PIECES_STORAGE, pieceStorage); - verifyPut(String.format(PIECES_ID_PATH, pieceId), pieceRequest, "", 204); + verifyPut(String.format(PIECES_ID_PATH, pieceId), pieceRequest, "", 204) + .then() + .assertThat() + .body("statusUpdatedDate", notNullValue());; // Message sent to event bus HandlersTestHelper.verifyReceiptStatusUpdateEvent(1); diff --git a/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java b/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java index 93684a9eb..375886d9b 100644 --- a/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java +++ b/src/test/java/org/folio/service/pieces/flows/update/PieceUpdateFlowManagerTest.java @@ -13,8 +13,7 @@ import static org.folio.service.inventory.InventoryManager.HOLDING_PERMANENT_LOCATION_ID; import static org.folio.service.inventory.InventoryManager.ITEM_STATUS; import static org.folio.service.inventory.InventoryManager.ITEM_STATUS_NAME; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; @@ -235,7 +234,7 @@ void shouldUpdateLineQuantityIfPoLineIsNotPackageAndHoldingReferenceChangedAndSh Piece pieceFromStorage = new Piece().withId(pieceId).withPoLineId(lineId).withItemId(itemId).withTitleId(titleId) .withHoldingId(oldHoldingId).withFormat(Piece.Format.ELECTRONIC); Piece incomingPieceToUpdate = new Piece().withId(pieceId).withPoLineId(lineId).withItemId(itemId).withTitleId(titleId) - .withHoldingId(holdingIdToUpdate).withFormat(Piece.Format.ELECTRONIC); + .withHoldingId(holdingIdToUpdate).withFormat(Piece.Format.ELECTRONIC).withReceivingStatus(Piece.ReceivingStatus.RECEIVED); Cost cost = new Cost().withQuantityElectronic(1); Location loc = new Location().withHoldingId(oldHoldingId).withQuantityElectronic(1).withQuantity(1); PoLine poLine = new PoLine().withIsPackage(false).withPurchaseOrderId(orderId).withId(lineId) @@ -265,6 +264,7 @@ void shouldUpdateLineQuantityIfPoLineIsNotPackageAndHoldingReferenceChangedAndSh Piece pieceToUpdate = pieceToUpdateCapture.getValue(); PieceUpdateHolder pieceUpdateHolder = pieceUpdateHolderCapture.getValue(); + assertNotNull(pieceToUpdate.getStatusUpdatedDate()); verify(basePieceFlowHolderBuilder).updateHolderWithOrderInformation(pieceUpdateHolderCapture.capture(), eq(requestContext)); verify(pieceUpdateFlowPoLineService).updatePoLine(pieceUpdateHolderCapture.capture(), eq(requestContext)); verify(pieceUpdateFlowInventoryManager).processInventory(any(PieceUpdateHolder.class), eq(requestContext));