Search in sources :

Example 31 with ContentValues

use of android.content.ContentValues in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_apply_shouldCrash.

@Test(expected = IllegalStateException.class)
public void init_apply_apply_shouldCrash() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    ContentValues cv = new ContentValues();
    state.applyValues(cv);
    state.applyValues(cv);
}
Also used : ContentValues(android.content.ContentValues) MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Example 32 with ContentValues

use of android.content.ContentValues in project k-9 by k9mail.

the class StoreSchemaDefinitionTest method insertMessageWithSubject.

private void insertMessageWithSubject(SQLiteDatabase database, String subject) {
    ContentValues data = new ContentValues();
    data.put("subject", subject);
    long rowId = database.insert("messages", null, data);
    assertNotEquals(-1, rowId);
}
Also used : ContentValues(android.content.ContentValues)

Example 33 with ContentValues

use of android.content.ContentValues in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_nextmulti_apply_shouldYieldMultipartChildValues.

@Test
public void init_apply_nextmulti_apply_shouldYieldMultipartChildValues() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    ContentValues cv = new ContentValues();
    state.applyValues(cv);
    state = state.nextMultipartChild(123);
    cv.clear();
    state.applyValues(cv);
    Assert.assertEquals(123L, cv.get("root"));
    Assert.assertEquals(123L, cv.get("parent"));
    Assert.assertEquals(1, 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)

Example 34 with ContentValues

use of android.content.ContentValues in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_nextmulti_apply_pop_apply_shouldYieldFirstParentIdValues.

@Test
public void init_apply_nextmulti_apply_pop_apply_shouldYieldFirstParentIdValues() 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);
    state = state.popParent();
    cv.clear();
    state.applyValues(cv);
    Assert.assertEquals(123L, cv.get("root"));
    Assert.assertEquals(123L, 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)

Example 35 with ContentValues

use of android.content.ContentValues in project k-9 by k9mail.

the class MigrationMimeStructureStateTest method init_apply_nextmulti_nextchild_shouldCrash.

@Test(expected = IllegalStateException.class)
public void init_apply_nextmulti_nextchild_shouldCrash() throws Exception {
    MimeStructureState state = MimeStructureState.getNewRootState();
    ContentValues cv = new ContentValues();
    state.applyValues(cv);
    state.nextMultipartChild(1);
    state.nextChild(1);
}
Also used : ContentValues(android.content.ContentValues) MimeStructureState(com.fsck.k9.mailstore.migrations.MigrationTo51.MimeStructureState) Test(org.junit.Test)

Aggregations

ContentValues (android.content.ContentValues)4022 Cursor (android.database.Cursor)721 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)638 Uri (android.net.Uri)619 Test (org.junit.Test)374 SQLException (android.database.SQLException)231 ContentResolver (android.content.ContentResolver)212 ArrayList (java.util.ArrayList)192 Intent (android.content.Intent)163 File (java.io.File)156 IOException (java.io.IOException)131 RemoteException (android.os.RemoteException)96 CursorAssert.assertThatCursor (org.hisp.dhis.android.core.data.database.CursorAssert.assertThatCursor)91 NonNull (android.support.annotation.NonNull)74 Date (java.util.Date)73 MediumTest (android.test.suitebuilder.annotation.MediumTest)63 HashMap (java.util.HashMap)62 JSONException (org.json.JSONException)60 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)55 SQLiteException (android.database.sqlite.SQLiteException)53