EmailSenderImpl implements EmailSender { @Override public void sendEmailToConfirmVerification(String xForwardedProto, String xForwardedHost, int xForwardedPort, String email, String recipientFullName) { Assert.hasText(email, "email must have text"); Assert.hasText(recipientFullName, "recipientFullName must have text"); final Context ctx = new Context(); ctx.setVariable(PARAM_RECIPIENT_NAME, recipientFullName); ctx.setVariable(PARAM_LINK_URL, toPPUIBaseUri(xForwardedProto, xForwardedHost, xForwardedPort)); ctx.setVariable(PARAM_BRAND, emailSenderProperties.getBrand()); ctx.setLocale(LocaleContextHolder.getLocale()); sendEmail(ctx, email, PROP_EMAIL_CONFIRM_VERIFICATION_SUBJECT, TEMPLATE_CONFIRM_VERIFICATION_EMAIL, PROP_EMAIL_FROM_ADDRESS, PROP_EMAIL_FROM_PERSONAL, LocaleContextHolder.getLocale()); }  @Override void sendEmailWithVerificationLink(String xForwardedProto, String xForwardedHost, int xForwardedPort, String email, String emailToken, String recipientFullName); @Override void sendEmailToConfirmVerification(String xForwardedProto, String xForwardedHost, int xForwardedPort, String email, String recipientFullName); @Override void sendEmailWithVerificationLinkAndLang(String xForwardedProto, String xForwardedHost, int xForwardedPort, String email, String emailToken, String recipientFullName, String language);  }
@Test public void testSendEmailToConfirmVerification() throws Exception { final String email = "email"; final String recipientFullName = "recipientFullName"; sut.sendEmailToConfirmVerification(xForwardedProto, xForwardedHost, xForwardedPort, email, recipientFullName); verify(templateEngineMock, times(1)).process(anyString(), any(Context.class)); verify(javaMailSenderMock, times(1)).send(any(MimeMessage.class)); }