MailNotification implements NotificationService { @Override public void sendNotification(NotificationServiceConfiguration serviceConfiguration, FileEventNotification.Type type, String userId, List<File> files, Map<String, Permission> sharedUsersIdWithPermission) { MailConfigurationParser configurationParser = new MailConfigurationParser(serviceConfiguration); String emailToSend = configurationParser.getMail(); if (type == FileEventNotification.Type.SHARE_WITH) { sendMailNotification(emailToSend, userId + " share file: " + displayFiles(files) + " with " + sharedUsersIdWithPermission.toString()); } else { sendMailNotification(emailToSend, userId + " " + type.name() + " file(s): " + displayFiles(files)); } } MailNotification(final String username, final String password); @Override String getServiceId(); @Override void sendNotification(NotificationServiceConfiguration serviceConfiguration, FileEventNotification.Type type, String userId, List<File> files, Map<String, Permission> sharedUsersIdWithPermission);  }
@Test public void testAddFileEvent_Should_When() throws Exception { mailNotification.sendNotification(configuration, FileEventNotification.Type.ADD, "Thibaut", Arrays.asList(new MockFile("0", "File1"), new MockFile("1", "File2")), Collections.emptyMap()); mailNotification.sendNotification(configuration, FileEventNotification.Type.DELETE, "Thibaut", Arrays.asList(new MockFile("0", "File1"), new MockFile("1", "File2")), Collections.emptyMap()); mailNotification.sendNotification(configuration, FileEventNotification.Type.SHARE_WITH, "Thibaut", Arrays.asList(new MockFile("0", "File1"), new MockFile("1", "File2")), Collections.singletonMap("Maxime", Permission.GET)); }