Code example for SQLiteDatabase

Methods: insertOrThrow

0
    } 
     
    @Test(expected = android.database.SQLException.class) 
    public void testInsertOrThrowWithSimulatedSQLException() { 
        shDatabase.setThrowOnInsert(true);
        database.insertOrThrow("table_name", null, new ContentValues());
    } 
 
    @Test(expected = android.database.SQLException.class) 
    public void testInsertOrThrowWithSQLException() { 
        ContentValues values = new ContentValues();
        values.put("id", 1);
 
        database.insertOrThrow("table_name", null, values);
        database.insertOrThrow("table_name", null, values);
    } 
     
    @Test 
    public void testInsertOrThrow() { 
        String stringColumnValue = "column_value";
        byte[] byteColumnValue = new byte[]{1, 2, 3};