-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMailServiceTest.java
More file actions
64 lines (51 loc) · 1.96 KB
/
Copy pathMailServiceTest.java
File metadata and controls
64 lines (51 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import http.helpers.MailService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import javax.mail.MessagingException;
@Ignore
public class MailServiceTest {
private static final String EMAIL = "myreaction.user1@gmail.com";
private static final String PASSWORD = "myreaction.user1-2015";
private static final String IMAP_HOST = "imap.gmail.com";
private MailService mailService;
@Test
public void testThatEmailListCanBeFetched() throws Exception {
mailService = new MailService();
mailService.login(IMAP_HOST, 993, EMAIL, PASSWORD);
Assert.assertTrue(mailService.isLoggedIn());
Assert.assertTrue(mailService.getMessageCount() >= 0);
}
@Test
public void testThatEmailListCanBeFetchedFromInbox() throws Exception {
mailService = new MailService();
mailService
.setFolder(MailService.MailFolder.INBOX)
.login(IMAP_HOST, 993, EMAIL, PASSWORD);
Assert.assertTrue(mailService.isLoggedIn());
Assert.assertTrue(mailService.getMessageCount() >= 0);
}
@Test
public void testThatEmailListCanBeFetchedFromSpam() throws Exception {
mailService = new MailService();
mailService
.setFolder(MailService.MailFolder.SPAM)
.login(IMAP_HOST, 993, EMAIL, PASSWORD);
Assert.assertTrue(mailService.isLoggedIn());
Assert.assertTrue(mailService.getMessageCount() >= 0);
}
@Test
public void testThatEmailListCanBeFetchedFromTrash() throws Exception {
mailService = new MailService();
mailService
.setFolder(MailService.MailFolder.TRASH)
.login(IMAP_HOST, 993, EMAIL, PASSWORD);
Assert.assertTrue(mailService.isLoggedIn());
Assert.assertTrue(mailService.getMessageCount() >= 0);
}
@After
public void tearDown() throws MessagingException {
mailService.logout();
}
}