From: David ‘Bombe’ Roden Date: Mon, 17 Mar 2014 20:50:24 +0000 (+0100) Subject: Add constructor takes a transport (for testing). X-Git-Tag: v2~252 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3d29a978468b2a50df87fd8239df66ff80fc07ee;p=rhynodge.git Add constructor takes a transport (for testing). --- 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 //