Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ThisBuild / organization := "app.softnetwork"

name := "notification"

ThisBuild / version := "0.9.1"
ThisBuild / version := "0.9.2"

ThisBuild / scalaVersion := scala212

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ trait NotificationTestKit[T <: Notification]

private var smtpMockServer: Option[SmtpMockServer] = None

protected def receivedEmails: Seq[com.dumbster.smtp.SmtpMessage] =
smtpMockServer.map(_.received).getOrElse(Seq.empty)
protected def initSmtpMockServer(coordinatedShutdown: Boolean): Unit = {
val server = new SmtpMockServer with InternalConfig {
lazy val log: Logger = LoggerFactory getLogger getClass.getName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import akka.Done
import akka.actor.typed.ActorSystem
import app.softnetwork.api.server.scalatest.MockServer
import app.softnetwork.notification.config.{InternalConfig, MailSettings}
import com.dumbster.smtp.SimpleSmtpServer
import com.dumbster.smtp.{SimpleSmtpServer, SmtpMessage}

import scala.concurrent.Future
import scala.jdk.CollectionConverters._
import scala.util.{Failure, Success, Try}

trait SmtpMockServer extends MockServer with MailSettings {
Expand Down Expand Up @@ -40,4 +41,8 @@ trait SmtpMockServer extends MockServer with MailSettings {
}
Future.successful(Done)
}

/** Mails received by this mock SMTP server since startup. */
def received: Seq[SmtpMessage] =
maybeServer.map(_.getReceivedEmails.asScala.toSeq).getOrElse(Seq.empty)
Comment thread
fupelaqu marked this conversation as resolved.
}
Loading