From 53cdca4ba76a5f8ef4692cb14d9a19d7441bcc3e Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo Date: Mon, 29 Jan 2024 10:19:08 +0100 Subject: [PATCH] fix tests --- .../user/service/UserInstitutionServiceTest.java | 4 ++-- .../selfcare/user/service/UserServiceTest.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserInstitutionServiceTest.java b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserInstitutionServiceTest.java index 4de5160d..34ce78bb 100644 --- a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserInstitutionServiceTest.java +++ b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserInstitutionServiceTest.java @@ -141,7 +141,7 @@ void updateUserStatusWithInstitutionAndOnboardedFilter() { String productId = "productId"; PanacheMock.mock(UserInstitution.class); ReactivePanacheUpdate update = Mockito.mock(ReactivePanacheUpdate.class); - when(UserInstitution.update((Document) any())) + when(UserInstitution.update(any(Document.class))) .thenReturn(update); when(update.where(any())).thenReturn(Uni.createFrom().item(1L)); UniAssertSubscriber subscriber = userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(userId, institutionId, productId, null, null, OnboardedProductState.ACTIVE) @@ -155,7 +155,7 @@ void updateUserStatusWithInstitutionFilter() { String institutionId = "institutionId"; PanacheMock.mock(UserInstitution.class); ReactivePanacheUpdate update = Mockito.mock(ReactivePanacheUpdate.class); - when(UserInstitution.update((Document) any())) + when(UserInstitution.update(any(Document.class))) .thenReturn(update); when(update.where(any())).thenReturn(Uni.createFrom().item(1L)); UniAssertSubscriber subscriber = userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(userId, institutionId, null, null, null, OnboardedProductState.ACTIVE) diff --git a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java index 8e879fa3..fb351d14 100644 --- a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java +++ b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java @@ -176,11 +176,12 @@ void testRetrievePersonFailsWhenPdvFails() { @Test void updateUserStatusWithOptionalFilter(){ - doNothing().when(userUtils).checkProductRole(any(), any(), any()); - when(userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(any(), any(), any(), any(), any(), any())).thenReturn(Uni.createFrom().item(1L)); + doNothing().when(userUtils).checkProductRole("prod-pagopa", PartyRole.MANAGER, null); + when(userInstitutionService + .updateUserStatusWithOptionalFilterByInstitutionAndProduct("userId", "institutionId", "prod-pagopa", PartyRole.MANAGER, null, OnboardedProductState.ACTIVE)).thenReturn(Uni.createFrom().item(1L)); UniAssertSubscriber subscriber = userService - .updateUserStatusWithOptionalFilter("userId", "institutionId", null, PartyRole.MANAGER, null, OnboardedProductState.ACTIVE) + .updateUserStatusWithOptionalFilter("userId", "institutionId", "prod-pagopa", PartyRole.MANAGER, null, OnboardedProductState.ACTIVE) .subscribe() .withSubscriber(UniAssertSubscriber.create()); @@ -189,11 +190,12 @@ void updateUserStatusWithOptionalFilter(){ @Test void updateUserStatusWithOptionalFilterUserNotFound(){ - doNothing().when(userUtils).checkProductRole(any(), any(), any()); - when(userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(any(), any(), any(), any(), any(), any())).thenReturn(Uni.createFrom().item(0L)); + doNothing().when(userUtils).checkProductRole("prod-pagopa", PartyRole.MANAGER, null); + when(userInstitutionService + .updateUserStatusWithOptionalFilterByInstitutionAndProduct("userId", "institutionId", "prod-pagopa", PartyRole.MANAGER, null, OnboardedProductState.ACTIVE)).thenReturn(Uni.createFrom().item(0L)); UniAssertSubscriber subscriber = userService - .updateUserStatusWithOptionalFilter("userId", "institutionId", null, PartyRole.MANAGER, null, OnboardedProductState.ACTIVE) + .updateUserStatusWithOptionalFilter("userId", "institutionId", "prod-pagopa", PartyRole.MANAGER, null, OnboardedProductState.ACTIVE) .subscribe() .withSubscriber(UniAssertSubscriber.create());