mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Change SendEmailService to an instance field.
This allows us to inject it with Dagger and avoid using InjectRule to set it in unit tests. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=217571475
This commit is contained in:
parent
06ce429c5a
commit
84c3544097
5 changed files with 14 additions and 20 deletions
|
@ -15,6 +15,8 @@
|
|||
package google.registry.util;
|
||||
|
||||
import java.util.Properties;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Session;
|
||||
|
@ -22,8 +24,12 @@ import javax.mail.Transport;
|
|||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
/** Wrapper around javax.mail's Transport.send that can be mocked for testing purposes. */
|
||||
@Singleton
|
||||
public class SendEmailService {
|
||||
|
||||
@Inject
|
||||
SendEmailService() {};
|
||||
|
||||
/** Returns a new MimeMessage using default App Engine transport settings. */
|
||||
public Message createMessage() {
|
||||
return new MimeMessage(Session.getDefaultInstance(new Properties(), null));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue