@Test public void testMessageResolution() { Experiment.Label label = Experiment.Label.valueOf("expLabel"); Experiment.ID id = Experiment.ID.newInstance(); ExperimentBase exp = Mockito.mock(Experiment.class); when(exp.getApplicationName()).thenReturn(appName); when(exp.getLabel()).thenReturn(label); when(exp.getID()).thenReturn(id); EventLogEvent event = new ExperimentCreateEvent(exp); String emailMessage = textProcessor.getMessage(event); assertTrue(emailMessage.contains(appName.toString())); assertTrue(emailMessage.contains(label.toString())); assertTrue(emailMessage.contains(id.toString())); }
@Override public String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); } }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); } @Inject  EmailTextProcessorImpl(final AuthorizationRepository authorizationRepository); }
EmailTextProcessorImpl implements EmailTextProcessor { @Override public String getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); } @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 getMessage(Application.Name app, UserInfo.Username username, EmailLinksList links) { ST appAccess = new ST(APP_ACCESS); Map<String, String> variables = new HashMap<>(); put(variables, APPLICATION_NAME, String.valueOf(app)); put(variables, USER_NAME, String.valueOf(username)); put(variables, EMAIL_LINKS, links.toString()); return replaceVariablesInTemplate(variables, appAccess); } @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);  }