java服务器测试,使用Java邮件服务器进行测试

I'm in the process of testing an application that takes mail out of a mailbox, performs some action based on the content of that mail, and then sends a response mail depending on the result of the action.

I'm looking for a way to write tests for this application. Ideally, I'd like for these tests to bring up their own mail server, push my test emails to a folder on this mail server, and have my application scrape the mail out of the mail server that my test started.

Configuring the application to use the mailserver is not difficult, but I do not know where to look for a programatic way of starting a mail server in Java. I've looked at JAMES, but I am unable to figure out how to start the server from within my test.

So the question is this: What can I use for a mail server in Java that I can configure and start entirely within Java?

解决方案

There is also very simple in use GreenMail which was designer as a mail server for automatic "unit" tests.

From projects web page (probably there are some others tools with sending/receiving functionality nowadays):

GreenMail is an open source, intuitive

and easy-to-use test suite of email

servers for testing purposes. Supports

SMTP, POP3, IMAP with SSL socket

support. GreenMail also provides a

JBoss GreenMail Service. GreenMail is

the fist and only library that offers

a test framework for both receiving

and retrieving emails from Java.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值