From cec344bfd3d80405073d71c44e672d2155f6d21d Mon Sep 17 00:00:00 2001 From: salander85 Date: Thu, 26 Oct 2023 12:12:11 +0200 Subject: [PATCH] Fix NPE in test --- .../project/sync/product/ProductSyncerTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/commercetools/project/sync/product/ProductSyncerTest.java b/src/test/java/com/commercetools/project/sync/product/ProductSyncerTest.java index 1188cc41..a0394ab7 100644 --- a/src/test/java/com/commercetools/project/sync/product/ProductSyncerTest.java +++ b/src/test/java/com/commercetools/project/sync/product/ProductSyncerTest.java @@ -272,9 +272,11 @@ void transform_WithErrorOnGraphQlRequest_ShouldContinueAndLogError() { @Test void getQuery_ShouldBuildProductQueryWithoutAnyExpansionPaths() { // preparation - final ProductSyncer productSyncer = - ProductSyncer.of( - mock(ProjectApiRoot.class), mock(ProjectApiRoot.class), getMockedClock(), null); + ProjectApiRoot apiRoot = mock(ProjectApiRoot.class); + when(apiRoot.productProjections()).thenReturn(mock()); + when(apiRoot.productProjections().get()).thenReturn(mock()); + when(apiRoot.productProjections().get().addStaged(anyBoolean())).thenReturn(mock()); + final ProductSyncer productSyncer = ProductSyncer.of(apiRoot, apiRoot, getMockedClock(), null); // test final ByProjectKeyProductProjectionsGet query = productSyncer.getQuery();