Skip to content

Commit

Permalink
chore: Clean test for mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-putzu committed Aug 28, 2024
1 parent e61d2d0 commit d9d7a5e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void sendNotification(ExecutionContext context, String topic, Notificati
try {
message = mapper.writeValueAsString(notificationToSend);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
throw new NotificationException("Notification cannot be serialized");
} finally {
String finalMessage = message;
context.getLogger().info(() -> String.format("Sending notification on topic: %s with message: %s", topic, finalMessage));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void sendNotificationsJsonError() {
TelemetryClient telemetryClient = mock(TelemetryClient.class);
doNothing().when(telemetryClient).trackEvent(anyString(), any(), any());

assertThrows(RuntimeException.class, () -> notificationServiceDefault.send(context, onboarding, QueueEvent.ADD));
assertThrows(NotificationException.class, () -> notificationServiceDefault.send(context, onboarding, QueueEvent.ADD));
}

private Onboarding createOnboarding() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,22 +263,7 @@ void toNotificationToSendForEcWhenPartyRegistryThrowsException() {
when(registryProxyInstitutionsApi.findInstitutionUsingGET(any(), any(), any()))
.thenThrow(new RuntimeException("Error"));

// NotificationToSend notification = sapNotificationBuilder.buildNotificationToSend(onboarding, token, institution, QueueEvent.ADD);
assertThrows(RuntimeException.class, () -> sapNotificationBuilder.buildNotificationToSend(onboarding, token, institution, QueueEvent.ADD));

// assertNotNull(notification);
// assertNull(notification.getClosedAt());
// assertEquals("ACTIVE", notification.getState());
// assertNotEquals(onboarding.getId(), notification.getId());
// assertEquals(onboarding.getActivatedAt(), notification.getCreatedAt().toLocalDateTime());
// assertEquals(onboarding.getActivatedAt(), notification.getUpdatedAt().toLocalDateTime());
// assertNull(notification.getBilling().getTaxCodeInvoicing());
// assertNull(notification.getBilling().isPublicServices());
// assertNull(notification.getNotificationType());
// assertEquals(NotificationType.ADD_INSTITUTE, notification.getType());
// assertNull(notification.getBilling().getTaxCodeInvoicing());
// assertEquals("taxCodeInvoicing", notification.getInstitution().getTaxCode());
// assertNull(notification.getInstitution().getIstatCode());
}

@Test
Expand Down

0 comments on commit d9d7a5e

Please sign in to comment.