1
2
3
4
5
6
7
8
9
10
11 package test.mock.mail;
12
13 import javax.mail.Authenticator;
14 import javax.mail.PasswordAuthentication;
15
16 public class MockAuthenticator extends Authenticator
17 {
18 private String username;
19 private String password;
20
21 public MockAuthenticator(String username, String password)
22 {
23 this.username = username;
24 this.password = password;
25 }
26
27 public PasswordAuthentication getPasswordAuthentication()
28 {
29 return new PasswordAuthentication(getUsername(), getPassword());
30 }
31
32 public String getUsername()
33 {
34 return username;
35 }
36
37 public String getPassword()
38 {
39 return password;
40 }
41 }