Skip to content

Instantly share code, notes, and snippets.

@willemsst
Created October 6, 2013 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willemsst/6856887 to your computer and use it in GitHub Desktop.
Save willemsst/6856887 to your computer and use it in GitHub Desktop.
akka james-smtp camel actor spock test
package be.idevelop.opencom.smtp.server.actor
import akka.actor.ActorSystem
import org.apache.commons.mail.SimpleEmail
import spock.lang.Shared
import spock.lang.Specification
class SmtpActorTest extends Specification {
@Shared
ActorSystem system
def setupSpec() {
system = ActorSystem.create("SMTP-unit-test")
system.actorOf(SmtpActor.create(system))
}
def cleanupSpec() {
system.shutdown()
}
def 'test send and receive real email'() {
given:
SimpleEmail email = new SimpleEmail()
email.setHostName('localhost')
email.setDebug(true)
email.setSmtpPort(25052)
email.setFrom('steven@opencom.io')
email.addTo('receiver@opencom.io')
email.setMsg('Test message')
when:
email.send()
then:
notThrown(Exception.class)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment