Clover Coverage Report - Atlassian Mail
Coverage timestamp: Mon Sep 29 2008 21:26:36 CDT
58   198   32   2
6   165   0.55   29
29     1.1  
1    
 
 
  MockSession       Line # 13 58 32 29% 0.29032257
 
  (7)
 
1    package test.mock.mail;
2   
3    import alt.javax.mail.Session;
4    import alt.javax.mail.Transport;
5    import com.mockobjects.ExpectationValue;
6    import com.mockobjects.MockObject;
7   
8    import javax.mail.*;
9    import java.util.HashMap;
10    import java.util.Map;
11    import java.util.Properties;
12   
 
13    public class MockSession extends MockObject implements Session
14    {
15    private Map urlAuthenticators = new HashMap();
16    private final ExpectationValue myDebug = new ExpectationValue("debug");
17    private Transport myTransport;
18    private Properties props;
19    private javax.mail.Session wrapped;
20   
 
21  1 toggle public Session getInstance(Properties props, Authenticator authenticator)
22    {
23  1 getInstance(props);
24  1 if (authenticator == null)
25  0 setPasswordAuthentication(new URLName((String) props.get("mail.smtp.host")), null);
26    else
27  1 setPasswordAuthentication(new URLName((String) props.get("mail.smtp.host")), ((MockAuthenticator) authenticator).getPasswordAuthentication());
28  1 wrapped = javax.mail.Session.getInstance(props, authenticator);
29  1 return this;
30    }
31   
 
32  1 toggle public Session getInstance(Properties props)
33    {
34  1 this.props = props;
35  1 wrapped = javax.mail.Session.getInstance(props);
36  1 return this;
37    }
38   
 
39  0 toggle public Session getDefaultInstance(Properties props, Authenticator authenticator)
40    {
41  0 wrapped = javax.mail.Session.getDefaultInstance(props, authenticator);
42  0 return getInstance(props, authenticator);
43    }
44   
 
45  0 toggle public Session getDefaultInstance(Properties props)
46    {
47  0 wrapped = javax.mail.Session.getDefaultInstance(props);
48  0 return getInstance(props);
49    }
50   
 
51  0 toggle public void setExpectedDebug(boolean aDebug)
52    {
53  0 myDebug.setActual(aDebug);
54    }
55   
 
56  0 toggle public void setDebug(boolean aDebug)
57    {
58  0 myDebug.setActual(aDebug);
59    }
60   
 
61  0 toggle public boolean getDebug()
62    {
63  0 notImplemented();
64  0 return false;
65    }
66   
 
67  0 toggle public Provider getProviders()[]
68    {
69  0 notImplemented();
70  0 return null;
71    }
72   
 
73  0 toggle public Provider getProvider(String name)
74    {
75  0 notImplemented();
76  0 return null;
77    }
78   
 
79  0 toggle public void setProvider(Provider provider)
80    {
81  0 notImplemented();
82    }
83   
 
84  10 toggle public Transport getTransport()
85    {
86  10 if (myTransport == null)
87  5 myTransport = new MockTransport();
88  10 return myTransport;
89    }
90   
 
91  0 toggle public void setupGetTransport(Transport aTransport)
92    {
93  0 myTransport = aTransport;
94    }
95   
 
96  5 toggle public Transport getTransport(String aTransportName)
97    {
98  5 if ("smtp".equals(aTransportName))
99  5 return getTransport();
100    else
101  0 return null;
102    }
103   
 
104  0 toggle public Transport getTransport(Address address)
105    {
106  0 notImplemented();
107  0 return null;
108    }
109   
 
110  0 toggle public Transport getTransport(Provider provider)
111    {
112  0 notImplemented();
113  0 return null;
114    }
115   
 
116  0 toggle public Transport getTransport(URLName url)
117    {
118  0 notImplemented();
119  0 return null;
120    }
121   
 
122  0 toggle public Store getStore()
123    {
124  0 notImplemented();
125  0 return null;
126    }
127   
 
128  0 toggle public Store getStore(String name)
129    {
130  0 notImplemented();
131  0 return null;
132    }
133   
 
134  0 toggle public Store getStore(URLName url)
135    {
136  0 notImplemented();
137  0 return null;
138    }
139   
 
140  0 toggle public Store getStore(Provider provider)
141    {
142  0 notImplemented();
143  0 return null;
144    }
145   
 
146  0 toggle public Folder getFolder()
147    {
148  0 notImplemented();
149  0 return null;
150    }
151   
 
152  0 toggle public Folder getFolder(Store store)
153    {
154  0 notImplemented();
155  0 return null;
156    }
157   
 
158  0 toggle public Folder getFolder(URLName url)
159    {
160  0 notImplemented();
161  0 return null;
162    }
163   
 
164  1 toggle public void setPasswordAuthentication(URLName url, PasswordAuthentication
165    passwordAuthentication)
166    {
167  1 urlAuthenticators.put(url.getHost(), passwordAuthentication);
168    }
169   
 
170  2 toggle public PasswordAuthentication getPasswordAuthentication(URLName url)
171    {
172  2 return (PasswordAuthentication) urlAuthenticators.get(url.getHost());
173    }
174   
 
175  0 toggle public PasswordAuthentication requestPasswordAuthentication(java.net.InetAddress address, int port, String protocol, String prompt, String defaultUserName)
176    {
177  0 notImplemented();
178  0 return null;
179    }
180   
 
181  0 toggle public Properties getProperties()
182    {
183  0 notImplemented();
184  0 return null;
185    }
186   
 
187  0 toggle public String getProperty(String name)
188    {
189  0 notImplemented();
190  0 return null;
191    }
192   
 
193  13 toggle public javax.mail.Session getWrappedSession()
194    {
195  13 return wrapped;
196    }
197   
198    }