Skip to content

Commit

Permalink
chore: Add test for resend notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-putzu committed Aug 28, 2024
1 parent d9d7a5e commit 60a716b
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,23 @@ void resendNotificationsActivity_failsParsingFilters() {

Mockito.verifyNoInteractions(notificationEventResenderService);
}

@Test
void resendNotificationsActivityException() throws JsonProcessingException {
ExecutionContext context = mock(ExecutionContext.class);
doReturn(Logger.getGlobal()).when(context).getLogger();
String filtersString = "{\"productId\":\"prod-pagopa\", \"status\":[\"COMPLETED\"]}";

doThrow(new NotificationException("Error")).when(notificationEventService).send(any(), any(), any(), any());
when(notificationEventResenderService.resendNotifications(any(), any())).thenReturn(null);

String nextFilter = function.resendNotificationsActivity(filtersString, context);

ArgumentCaptor<ResendNotificationsFilters> filtersStringCaptor = ArgumentCaptor.forClass(ResendNotificationsFilters.class);
Mockito.verify(notificationEventResenderService, times(1))
.resendNotifications(filtersStringCaptor.capture(), any());
assertEquals("prod-pagopa", filtersStringCaptor.getValue().getProductId());
assertNull(nextFilter);
}
}

0 comments on commit 60a716b

Please sign in to comment.