Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminiaScarciofolo committed Jan 29, 2024
1 parent ffedad9 commit 53cdca4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Long> subscriber = userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(userId, institutionId, productId, null, null, OnboardedProductState.ACTIVE)
Expand All @@ -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<Long> subscriber = userInstitutionService.updateUserStatusWithOptionalFilterByInstitutionAndProduct(userId, institutionId, null, null, null, OnboardedProductState.ACTIVE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Void> 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());

Expand All @@ -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<Void> 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());

Expand Down

0 comments on commit 53cdca4

Please sign in to comment.