Class GreenMailRule
java.lang.Object
com.icegreen.greenmail.configuration.ConfiguredGreenMail
com.icegreen.greenmail.util.GreenMailProxy
com.icegreen.greenmail.junit.GreenMailRule
- All Implemented Interfaces:
GreenMailOperations, MethodRule, TestRule
Deprecated.
Use com.icegreen.greenmail.junit4.GreenMailRule of module greenmail-junit4. Will be removed in GreenMail 2.0 .
GreenMail JUnit 4 rule for hooking GreenMail into test lifecycle (startup GreenMail, shutdown GreenMail).
The rule ensures that each test method starts with a clean GreenMail instance without relics from previous tests of current suite.
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.GreenMailRule(ServerSetup serverSetup) Deprecated.Initialize with single server setupsGreenMailRule(ServerSetup[] serverSetups) Deprecated.Initialize with multiple server setups -
Method Summary
Modifier and TypeMethodDescriptionapply(Statement base, Description description) Deprecated.apply(Statement base, FrameworkMethod method, Object target) Deprecated.protected GreenMailDeprecated.booleanDeprecated.Checks if GreenMail is up and running.Deprecated.Configure GreenMail instance using the given configurationMethods inherited from class GreenMailProxy
findReceivedMessages, getImap, getImaps, getManagers, getPop3, getPop3s, getReceivedMessages, getReceivedMessagesForDomain, getSmtp, getSmtps, getUserManager, loadEmails, purgeEmailFromAllMailboxes, reset, setQuotaSupported, setUser, setUser, setUsers, start, stop, waitForIncomingEmail, waitForIncomingEmailModifier and TypeMethodDescriptionfindReceivedMessages(Predicate<GreenMailUser> userPredicate, Predicate<MimeMessage> messagePredicate) Finds all messages matching the user account and message predicate.getImap()getImaps()getPop3()getPop3s()getReceivedMessagesForDomain(String domain) Gets all messages containing given domain.getSmtp()getSmtps()loadEmails(Path path) Loads emails from given path.voidRemove/purge all data from all mail stores (POP3/IMAP)voidreset()Restart the GreenMail server.voidsetQuotaSupported(boolean isEnabled) Toggles the IMAP quota support.Sets the password for the account linked to email.Sets the password for the account linked to email.voidsetUsers(Properties users) Sets up accounts with password based on a properties map where the key is the email/login and the value the passwordvoidstart()Start the GreenMail servervoidstop()Stop the GreenMail server.booleanwaitForIncomingEmail(int emailCount) Does the same thing asGreenMailOperations.waitForIncomingEmail(long, int)but with a default timeout of 5000msbooleanwaitForIncomingEmail(long timeout, int emailCount) Use this method if you are sending email in a different thread from the one you're testing from.Methods inherited from class ConfiguredGreenMail
doConfigureModifier and TypeMethodDescriptionprotected voidThis method can be used by child classes to apply the configuration that is stored in config.
-
Constructor Details
-
GreenMailRule
Deprecated.Initialize with multiple server setups- Parameters:
serverSetups- All setups to use
-
GreenMailRule
Deprecated.Initialize with single server setups- Parameters:
serverSetup- Setup to use
-
GreenMailRule
public GreenMailRule()Deprecated.
-
-
Method Details
-
apply
Deprecated. -
apply
Deprecated.- Specified by:
applyin interfaceMethodRule
-
withConfiguration
Deprecated.Description copied from interface:GreenMailOperationsConfigure GreenMail instance using the given configuration- Specified by:
withConfigurationin interfaceGreenMailOperations- Overrides:
withConfigurationin classConfiguredGreenMail- Parameters:
config- Configuration to use- Returns:
- self (for method chaining)
-
isRunning
public boolean isRunning()Deprecated.Description copied from interface:GreenMailOperationsChecks if GreenMail is up and running.- Specified by:
isRunningin interfaceGreenMailOperations- Returns:
- true if ready to serve.
-
getGreenMail
Deprecated.- Specified by:
getGreenMailin classGreenMailProxy- Returns:
- Greenmail instance provided by child class
-