Search in sources :

Example 11 with MimeStructureState

use of com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_shouldYieldStartValues.

@Test
public void init_apply_shouldYieldStartValues() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    ContentValues cv = new ContentValues();
    state.applyValues(cv);
    Assert.assertEquals(-1L, cv.get("parent"));
    Assert.assertEquals(0, cv.get("seq"));
    Assert.assertEquals(2, cv.size());
}
Also used : ContentValues(android.content.ContentValues) MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Example 12 with MimeStructureState

use of com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_popParent_shouldCrash.

@Test(expected = IllegalStateException.class)
public void init_popParent_shouldCrash() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    state.popParent();
}
Also used : MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Example 13 with MimeStructureState

use of com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_nextchild_shouldCrash.

@Test(expected = IllegalStateException.class)
public void init_nextchild_shouldCrash() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    state.nextChild(1);
}
Also used : MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Example 14 with MimeStructureState

use of com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_nextmulti_shouldCrash.

@Test(expected = IllegalStateException.class)
public void init_nextmulti_shouldCrash() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    state.nextMultipartChild(1);
}
Also used : MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Example 15 with MimeStructureState

use of com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_nextmulti_apply_nextmulti_apply_shouldYieldSecondMultipartChildValues.

@Test
public void init_apply_nextmulti_apply_nextmulti_apply_shouldYieldSecondMultipartChildValues() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    ContentValues cv = new ContentValues();
    state.applyValues(cv);
    state = state.nextMultipartChild(123);
    cv.clear();
    state.applyValues(cv);
    state = state.nextMultipartChild(456);
    cv.clear();
    state.applyValues(cv);
    Assert.assertEquals(123L, cv.get("root"));
    Assert.assertEquals(456L, cv.get("parent"));
    Assert.assertEquals(2, cv.get("seq"));
    Assert.assertEquals(3, cv.size());
}
Also used : ContentValues(android.content.ContentValues) MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Aggregations

ContentValues (android.content.ContentValues)12 MimeStructureState (com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState)11 Test (org.junit.Test)11 MimeHeader (com.fsck.k9.mail.internet.MimeHeader)4 File (java.io.File)2 IOException (java.io.IOException)2 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 Account (com.fsck.k9.Account)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 QuotedPrintableOutputStream (org.apache.james.mime4j.codec.QuotedPrintableOutputStream)1