use of com.fsck.k9.mail.Folder in project k-9 by k9mail.
the class WebDavStoreTest method getPersonalNamespaces_shouldProvideListOfAllFoldersSentFromResponses.
@Test
public void getPersonalNamespaces_shouldProvideListOfAllFoldersSentFromResponses() throws Exception {
StoreConfig storeConfig = createStoreConfig("webdav://user:password@example.org:80");
WebDavStore webDavStore = new WebDavStore(storeConfig, mockHttpClientFactory);
configureHttpResponses(UNAUTHORIZED_401_RESPONSE, OK_200_RESPONSE, createOkPropfindResponse(), createOkSearchResponse());
List<? extends Folder> folders = webDavStore.getPersonalNamespaces(true);
List<HttpGeneric> requests = requestCaptor.getAllValues();
assertEquals(3, folders.size());
}
use of com.fsck.k9.mail.Folder in project k-9 by k9mail.
the class WebDavStoreTest method getFolder_calledTwice_shouldReturnFirstInstance.
@Test
public void getFolder_calledTwice_shouldReturnFirstInstance() throws Exception {
WebDavStore webDavStore = createDefaultWebDavStore();
String folderName = "Trash";
Folder webDavFolder = webDavStore.getFolder(folderName);
Folder result = webDavStore.getFolder(folderName);
assertSame(webDavFolder, result);
}
use of com.fsck.k9.mail.Folder in project k-9 by k9mail.
the class ImapStoreTest method getFolder_calledTwice_shouldReturnFirstInstance.
@Test
public void getFolder_calledTwice_shouldReturnFirstInstance() throws Exception {
String folderName = "Trash";
Folder imapFolder = imapStore.getFolder(folderName);
Folder result = imapStore.getFolder(folderName);
assertEquals(imapFolder, result);
}
use of com.fsck.k9.mail.Folder in project k-9 by k9mail.
the class ImapStoreTest method getFolder_shouldReturnImapFolderInstance.
@Test
public void getFolder_shouldReturnImapFolderInstance() throws Exception {
Folder result = imapStore.getFolder("INBOX");
assertEquals(ImapFolder.class, result.getClass());
}
use of com.fsck.k9.mail.Folder in project k-9 by k9mail.
the class ImapFolderTest method fetchPart_withTextSection_shouldProcessImapResponses.
@Test
public void fetchPart_withTextSection_shouldProcessImapResponses() throws Exception {
ImapFolder folder = createFolder("Folder");
prepareImapFolderForOpen(OPEN_MODE_RO);
folder.open(OPEN_MODE_RO);
ImapMessage message = createImapMessage("1");
Part part = createPlainTextPart("1.1");
setupSingleFetchResponseToCallback();
folder.fetchPart(message, part, null);
ArgumentCaptor<Body> bodyArgumentCaptor = ArgumentCaptor.forClass(Body.class);
verify(part).setBody(bodyArgumentCaptor.capture());
Body body = bodyArgumentCaptor.getValue();
Buffer buffer = new Buffer();
body.writeTo(buffer.outputStream());
assertEquals("text", buffer.readUtf8());
}
Aggregations