01: // Copyright © 2006-2007 ASERT. Released under the Canoo Webtest license.
02: package com.canoo.webtest.plugins.emailtest;
03:
04: import javax.mail.Folder;
05: import javax.mail.Message;
06: import javax.mail.MessagingException;
07:
08: /**
09: * Stores the number of messages into a property.
10: *
11: * @author Paul King, ASERT
12: * @webtest.step category="Email"
13: * name="emailStoreMessageCount"
14: * description="Stores the number of messages (optionally matching provided criteria) into a property."
15: */
16: public class EmailStoreMessageCount extends AbstractSelectStep {
17: /**
18: * Calculate the count
19: *
20: * @param folder
21: * @return The extracted count value
22: */
23: protected String processContent(final Folder folder)
24: throws MessagingException {
25: final Message[] messages = retrieveMatchingMessages(folder);
26: return String.valueOf(messages.length);
27: }
28:
29: }
|