Add constructor takes a transport (for testing).
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 17 Mar 2014 20:50:24 +0000 (21:50 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 17 Mar 2014 20:50:24 +0000 (21:50 +0100)
src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java

index 5c57822..180b23f 100644 (file)
@@ -35,6 +35,7 @@ import javax.mail.internet.MimeMultipart;
 import net.pterodactylus.rhynodge.Action;
 import net.pterodactylus.rhynodge.output.Output;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.sun.mail.smtp.SMTPTransport;
 
 /**
@@ -73,6 +74,14 @@ public class EmailAction implements Action {
                transport = new SMTPTransport(session, new URLName("smtp", hostname, 25, null, "", ""));
        }
 
+       @VisibleForTesting
+       EmailAction(Transport transport, String sender, String recipient) {
+               this.transport = transport;
+               this.sender = sender;
+               this.recipient = recipient;
+               this.session = getInstance(getProperties());
+       }
+
        //
        // ACTION METHODS
        //