From 3d29a978468b2a50df87fd8239df66ff80fc07ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 17 Mar 2014 21:50:24 +0100 Subject: [PATCH] Add constructor takes a transport (for testing). --- .../java/net/pterodactylus/rhynodge/actions/EmailAction.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java b/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java index 5c57822..180b23f 100644 --- a/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java +++ b/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java @@ -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 // -- 2.7.4