### Question:
AlbumMediaNotificationManager { public void putCreationOf(final AlbumMedia albumMedia, final User by) { final NotificationAlbumJob job = getNotificationAlbumJob(by, albumMedia); job.registerCreation(albumMedia.getMedia()); } AlbumMediaNotificationManager(); static AlbumMediaNotificationManager get(); void putCreationOf(final AlbumMedia albumMedia, final User by); void putDeletionOf(final AlbumMedia albumMedia, final User by);  }### Answer:
@Test void putCreation() throws Exception { testedManager.putCreationOf(albumMediaA, senderX); assertThat(getContextCache().size(), is(0)); verify(scheduler, times(0)).unscheduleJob(anyString()); verify(scheduler, times(0)).scheduleJob(any(NotificationAlbumJob.class), any(JobTrigger.class)); final ArgumentCaptor<GalleryAlbumMediaSubscriptionNotificationBuilder> captor = forClass( GalleryAlbumMediaSubscriptionNotificationBuilder.class); verify(userNotificationManager, times(1)).buildAndSend(captor.capture()); final GalleryAlbumMediaSubscriptionNotificationBuilder builder = captor.getValue(); assertUserNotificationBuilder(builder, albumDetail1); }
@Test void putCreationWithDelayButUnscheduleError() throws Exception { doThrow(new SchedulerException("Error test")).when(scheduler).unscheduleJob(anyString()); gallerySettings.put("subscription.notification.delay", "10"); testedManager.putCreationOf(albumMediaA, senderX); assertThat(getContextCache().size(), is(0)); verify(scheduler, times(1)).unscheduleJob(anyString()); verify(scheduler, times(0)).scheduleJob(any(NotificationAlbumJob.class), any(JobTrigger.class)); final ArgumentCaptor<GalleryAlbumMediaSubscriptionNotificationBuilder> captor = forClass( GalleryAlbumMediaSubscriptionNotificationBuilder.class); verify(userNotificationManager, times(1)).buildAndSend(captor.capture()); final GalleryAlbumMediaSubscriptionNotificationBuilder builder = captor.getValue(); assertUserNotificationBuilder(builder, albumDetail1); }
@Test void putCreationWithDelayButScheduleError() throws Exception { doThrow(new SchedulerException("Error test")).when(scheduler) .scheduleJob(any(NotificationAlbumJob.class), any(JobTrigger.class)); gallerySettings.put("subscription.notification.delay", "10"); testedManager.putCreationOf(albumMediaA, senderX); assertThat(getContextCache().size(), is(0)); verify(scheduler, times(1)).unscheduleJob(anyString()); verify(scheduler, times(1)).scheduleJob(any(NotificationAlbumJob.class), any(JobTrigger.class)); final ArgumentCaptor<GalleryAlbumMediaSubscriptionNotificationBuilder> captor = forClass( GalleryAlbumMediaSubscriptionNotificationBuilder.class); verify(userNotificationManager, times(1)).buildAndSend(captor.capture()); final GalleryAlbumMediaSubscriptionNotificationBuilder builder = captor.getValue(); assertUserNotificationBuilder(builder, albumDetail1); }