EmailSenderImpl implements EmailSender { @Override public void sendEmailWithVerificationLink(String xForwardedProto, String xForwardedHost, int xForwardedPort, String email, String emailToken, String recipientFullName) { Assert.hasText(emailToken, "emailToken must have text"); Assert.hasText(email, "email must have text"); Assert.hasText(recipientFullName, "recipientFullName must have text"); final String fragment = emailSenderProperties.getPpUiVerificationEmailTokenArgName() + "=" + emailToken; final String verificationUrl = toPPUIVerificationUri(xForwardedProto, xForwardedHost, xForwardedPort, fragment); final Context ctx = new Context(); ctx.setVariable(PARAM_RECIPIENT_NAME, recipientFullName); ctx.setVariable(PARAM_LINK_URL, verificationUrl); ctx.setVariable(PARAM_BRAND, emailSenderProperties.getBrand()); ctx.setLocale(LocaleContextHolder.getLocale()); sendEmail(ctx, email, PROP_EMAIL_VERIFICATION_LINK_SUBJECT, TEMPLATE_VERIFICATION_LINK_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 testSendEmailWithVerificationLink() throws Exception { final String email = "email"; final String emailToken = "emailToken"; final String recipientFullName = "recipientFullName"; sut.sendEmailWithVerificationLink(xForwardedProto, xForwardedHost, xForwardedPort, email, emailToken, recipientFullName); verify(templateEngineMock, times(1)).process(anyString(), any(Context.class)); verify(javaMailSenderMock, times(1)).send(any(MimeMessage.class)); }