Merge pull request #2986 from philipwhiuk/testBodyStructure
Add test for IMAP FETCH BODYSTRUCTURE
This commit is contained in:
commit
d50319053a
1 changed files with 17 additions and 0 deletions
|
@ -834,6 +834,23 @@ public class ImapFolderTest {
|
||||||
verify(imapConnection).sendCommand("UID FETCH 1 (UID BODYSTRUCTURE)", false);
|
verify(imapConnection).sendCommand("UID FETCH 1 (UID BODYSTRUCTURE)", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fetch_withStructureFetchProfile_shouldSetContentType() throws Exception {
|
||||||
|
ImapFolder folder = createFolder("Folder");
|
||||||
|
prepareImapFolderForOpen(OPEN_MODE_RO);
|
||||||
|
folder.open(OPEN_MODE_RO);
|
||||||
|
String bodyStructure = "(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"US-ASCII\") NIL NIL \"7BIT\" 2279 48)";
|
||||||
|
when(imapConnection.readResponse(any(ImapResponseCallback.class)))
|
||||||
|
.thenReturn(createImapResponse("* 1 FETCH (BODYSTRUCTURE "+bodyStructure+" UID 1)"))
|
||||||
|
.thenReturn(createImapResponse("x OK"));
|
||||||
|
List<ImapMessage> messages = createImapMessages("1");
|
||||||
|
FetchProfile fetchProfile = createFetchProfile(Item.STRUCTURE);
|
||||||
|
|
||||||
|
folder.fetch(messages, fetchProfile, null);
|
||||||
|
|
||||||
|
verify(messages.get(0)).setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain;\r\n CHARSET=\"US-ASCII\"");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fetch_withBodySaneFetchProfile_shouldIssueRespectiveCommand() throws Exception {
|
public void fetch_withBodySaneFetchProfile_shouldIssueRespectiveCommand() throws Exception {
|
||||||
ImapFolder folder = createFolder("Folder");
|
ImapFolder folder = createFolder("Folder");
|
||||||
|
|
Loading…
Reference in a new issue