Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the ability to instantiate GreenMail per-class in addition to per-method #332

Merged
merged 1 commit into from
Jul 8, 2020
Merged

feat: add the ability to instantiate GreenMail per-class in addition to per-method #332

merged 1 commit into from
Jul 8, 2020

Conversation

netmikey
Copy link
Contributor

@netmikey netmikey commented Jul 2, 2020

I had a use case where I needed GreenMail to be instantiated once per test class instead of once per test method. This behaviour was added to the JUnit5 GreenMailExtension. Of course, this change is made backwards compatible so it doesn't affect existing code. The corresponding test class com.icegreen.greenmail.junit5.AlternateLifecyclesTests shows how the lifecycle can be switched, essentially:

@RegisterExtension
GreenMailExtension greenMail = new GreenMailExtension()
    .withPerMethodLifecycle(false)
    .withConfiguration(...);

The extension works very well, please consider publishing the JUnit5 module to Maven Central.

@marcelmay marcelmay self-assigned this Jul 2, 2020
@marcelmay marcelmay added this to the 1.6 milestone Jul 2, 2020
@marcelmay marcelmay merged commit fa9ef04 into greenmail-mail-test:master Jul 8, 2020
@marcelmay
Copy link
Member

Thx alot, @netmikey !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants