Skip to content

Commit

Permalink
[MODORDERS-1079] Fixed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-git committed Apr 3, 2024
1 parent b035e25 commit 4f438c5
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class PieceUpdateFlowManagerTest {
@Autowired PieceService pieceService;
@Autowired BasePieceFlowHolderBuilder basePieceFlowHolderBuilder;
@Autowired PieceUpdateFlowPoLineService pieceUpdateFlowPoLineService;
@Autowired PurchaseOrderLineService purchaseOrderLineService;

private final Context ctx = getFirstContextFromVertx(getVertx());
@Mock
Expand Down Expand Up @@ -119,8 +120,8 @@ public static void after() {
@AfterEach
void resetMocks() {
clearServiceInteractions();
Mockito.reset(pieceStorageService, pieceService, protectionService,
pieceUpdateFlowPoLineService, pieceUpdateFlowInventoryManager, basePieceFlowHolderBuilder);
Mockito.reset(pieceStorageService, pieceService, protectionService, pieceUpdateFlowPoLineService,
pieceUpdateFlowInventoryManager, basePieceFlowHolderBuilder, purchaseOrderLineService);
}

@Test
Expand Down Expand Up @@ -173,6 +174,8 @@ void shouldNotUpdateLineQuantityIfPoLineIsPackageAndShouldRunProcessInventory()
doReturn(succeededFuture(null)).when(pieceUpdateFlowInventoryManager).processInventory(any(PieceUpdateHolder.class), eq(requestContext));
doNothing().when(pieceService).receiptConsistencyPiecePoLine(any(JsonObject.class), eq(requestContext));
doReturn(succeededFuture(null)).when(pieceUpdateFlowPoLineService).updatePoLine(pieceUpdateHolderCapture.capture(), eq(requestContext));
doReturn(succeededFuture(null))
.when(purchaseOrderLineService).saveOrderLine(any(CompositePoLine.class), eq(requestContext));

//When
pieceUpdateFlowManager.updatePiece(pieceToUpdate, true, true, requestContext).result();
Expand Down Expand Up @@ -410,8 +413,8 @@ private static class ContextConfiguration {
return mock(InventoryCache.class);
}

@Bean PurchaseOrderLineService defaultPurchaseOrderLineService(RestClient restClient, InventoryCache inventoryCache) {
return spy(new PurchaseOrderLineService(restClient, inventoryCache));
@Bean PurchaseOrderLineService purchaseOrderLineService() {
return mock(PurchaseOrderLineService.class);
}

@Bean
Expand Down

0 comments on commit 4f438c5

Please sign in to comment.