### Question:
AbstractNotificationServiceImpl implements AbstractNotificationService<T> { @Transactional @Nonnull @Override public T updateNotificationState(@Nonnull final Long notificationId, @Nonnull final NotificationState notificationState) { assertNotificationIdNotNull(notificationId); Assert.notNull(notificationState, "Notification state should not be null"); LOGGER.debug("Updating notification state for notification with id - {}, state - {}", notificationId, notificationState); T notification = getRepository().findById(notificationId).orElseThrow(() -> new NotificationNotFoundForIdException(notificationId, getInstanceClass())); notification.setState(notificationState); notification.setUpdated(LocalDateTime.now()); notification = getRepository().save(notification); LOGGER.debug("Successfully updated state for notification with id - {}, notification state - {}", notificationId, notificationState); 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 testUpdateNotificationStateWithInvalidArguments() { final Long notificationId = 1L; final NotificationState state = NotificationState.PROCESSING; resetAll(); replayAll(); try { getService().updateNotificationState(null, state); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } try { getService().updateNotificationState(notificationId, null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } verifyAll(); }
@Test public void testUpdateNotificationState() { final Long notificationId = 1L; final T notification = getInstance(); notification.setId(notificationId); final LocalDateTime notificationUpdated = notification.getUpdated(); final NotificationState state = NotificationState.PROCESSING; 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().updateNotificationState(notificationId, state); assertEquals(state, result.getState()); assertTrue(result.getUpdated().compareTo(notificationUpdated) >= 0 && notificationUpdated != result.getUpdated()); verifyAll(); }