KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > mail > internet > MockMimeMessageFactory


1 package com.mockobjects.mail.internet;
2
3 import com.mockobjects.*;
4 import alt.javax.mail.Session;
5 import alt.javax.mail.internet.MimeMessageFactory;
6
7 import alt.javax.mail.internet.MimeMessage;
8
9 public class MockMimeMessageFactory extends MockObject implements
10     MimeMessageFactory {
11
12     private final ExpectationValue mySession = new ExpectationValue("session");
13     private final ReturnValue myMimeMessage = new ReturnValue("mime message");
14
15     public void setExpectedSession(Session aSession) {
16         mySession.setExpected(aSession);
17     }
18
19     public void setupCreateMimeMessage(MimeMessage aMimeMessage) {
20         myMimeMessage.setValue(aMimeMessage);
21     }
22
23     public MimeMessage createMimeMessage(Session aSession) {
24         mySession.setActual(aSession);
25         return (MimeMessage)myMimeMessage.getValue();
26     }
27
28 }
29
Popular Tags