### Question:
AbstractNotificationServiceImpl implements AbstractNotificationService<T> { @Transactional @Nonnull @Override public T updateProviderExternalUuid(@Nonnull final Long notificationId, @Nonnull final String providerExternalUuid) { assertNotificationIdNotNull(notificationId); Assert.notNull(providerExternalUuid, "Provider external uuid should not be null"); LOGGER.debug("Updating notification provider external uuid, notification id - {}, uuid - {}", notificationId, providerExternalUuid); T notification = getRepository().findById(notificationId).orElseThrow(() -> new NotificationNotFoundForIdException(notificationId, getInstanceClass())); notification.setProviderExternalUuId(providerExternalUuid); notification.setUpdated(LocalDateTime.now()); notification = getRepository().save(notification); LOGGER.debug("Successfully updated notification external uuid for notification with id - {}, notification - {}", notification.getId(), notification); return notification; } AbstractNotificationServiceImpl(); @Nonnull @Override T getNotificationById(@Nonnull final Long notificationId); @Transactional @Nonnull @Override T updateNotificationState(@Nonnull final Long notificationId, @Nonnull final NotificationState notificationState); @Transactional @Nonnull @Override T updateProviderExternalUuid(@Nonnull final Long notificationId, @Nonnull final String providerExternalUuid);  }### Answer:
@Test public void testUpdateProviderExternalUuidWithInvalidArguments() { final Long notificationId = 1L; final String providerExternalUuId = "KUYFTIRUR^^GCKVLV:LYC^r8r58GCFJG"; resetAll(); replayAll(); try { getService().updateProviderExternalUuid(null, providerExternalUuId); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } try { getService().updateProviderExternalUuid(notificationId, null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } verifyAll(); }
@Test public void testUpdateProviderExternalUuid() { final Long notificationId = 1L; final T notification = getInstance(); notification.setId(notificationId); final String providerExternalUuId = "KUYFTIRUR^^GCKVLV:LYC^r8r58GCFJG"; resetAll(); expect(getRepository().findById(eq(notificationId))).andReturn(Optional.of(notification)).once(); expect(getRepository().save(isA(getInstanceClass()))).andAnswer(() -> (T) getCurrentArguments()[0]).once(); replayAll(); final T result = getService().updateProviderExternalUuid(notificationId, providerExternalUuId); assertNotNull(result); assertEquals(providerExternalUuId, result.getProviderExternalUuId()); verifyAll(); }