@Test(expected = IllegalArgumentException.class) public void testSubjectExtraction() { EventLogEvent mockedEventLog = mock(EventLogEvent.class); assertThat(textProcessor.getSubject(appName), is("A User requests access to your Application")); when(mockedEventLog.getType()).thenReturn(BUCKET_CHANGED); String subject = textProcessor.getSubject(mockedEventLog); assertTrue(StringUtils.containsIgnoreCase(subject, "bucket")); when(mockedEventLog.getType()).thenReturn(EXPERIMENT_CHANGED); subject = textProcessor.getSubject(mockedEventLog); assertTrue(StringUtils.containsIgnoreCase(subject, "experiment")); when(mockedEventLog.getType()).thenReturn(EventLogEventType.EXPERIMENT_CREATED); subject = textProcessor.getSubject(mockedEventLog); assertThat(subject, is("Experiment Created")); when(mockedEventLog.getType()).thenReturn(EventLogEventType.UNKNOWN); subject = textProcessor.getSubject(mockedEventLog); fail(); assertThat(subject, is("NOT_POSSIBLE")); }
@Override public String getSubject(Application.Name app) { return "A User requests access to your Application"; }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getSubject(Application.Name app) { return "A User requests access to your Application"; } }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getSubject(Application.Name app) { return "A User requests access to your Application"; } @Inject  EmailTextProcessorImpl(final AuthorizationRepository authorizationRepository); }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getSubject(Application.Name app) { return "A User requests access to your Application"; } @Inject  EmailTextProcessorImpl(final AuthorizationRepository authorizationRepository); @Override Set<String> getAddressees(EventLogEvent event); @Override Set<String> getAddressees(Application.Name app); @Override String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links); @Override String getSubject(Application.Name app); @Override String getSubject(EventLogEvent event); @Override String getMessage(EventLogEvent event); }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getSubject(Application.Name app) { return "A User requests access to your Application"; } @Inject  EmailTextProcessorImpl(final AuthorizationRepository authorizationRepository); @Override Set<String> getAddressees(EventLogEvent event); @Override Set<String> getAddressees(Application.Name app); @Override String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links); @Override String getSubject(Application.Name app); @Override String getSubject(EventLogEvent event); @Override String getMessage(EventLogEvent event);  }