@Test(expected = SQLiteException.class) public void testUniqueInsert() throws JSONException { siberiStorage.insert("test_001_change_button_color", 4, createMetaData()); siberiStorage.insert("test_001_change_button_color", 2, createMetaData()); }
@Override public void insert(String testName, int variant, JSONObject metaData) { ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_NAME, testName); contentValues.put(COLUMN_VARIANT, variant); if(metaData != null) { contentValues.put(COLUMN_META, metaData.toString()); } mDb.insertOrThrow(TABLE_NAME, null, contentValues); }
SiberiSQLStorage extends SQLiteOpenHelper implements SiberiStorage { @Override public void insert(String testName, int variant, JSONObject metaData) { ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_NAME, testName); contentValues.put(COLUMN_VARIANT, variant); if(metaData != null) { contentValues.put(COLUMN_META, metaData.toString()); } mDb.insertOrThrow(TABLE_NAME, null, contentValues); } }
SiberiSQLStorage extends SQLiteOpenHelper implements SiberiStorage { @Override public void insert(String testName, int variant, JSONObject metaData) { ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_NAME, testName); contentValues.put(COLUMN_VARIANT, variant); if(metaData != null) { contentValues.put(COLUMN_META, metaData.toString()); } mDb.insertOrThrow(TABLE_NAME, null, contentValues); } SiberiSQLStorage(Context context); }
SiberiSQLStorage extends SQLiteOpenHelper implements SiberiStorage { @Override public void insert(String testName, int variant, JSONObject metaData) { ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_NAME, testName); contentValues.put(COLUMN_VARIANT, variant); if(metaData != null) { contentValues.put(COLUMN_META, metaData.toString()); } mDb.insertOrThrow(TABLE_NAME, null, contentValues); } SiberiSQLStorage(Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void insert(String testName, int variant, JSONObject metaData); @Override ExperimentContent select(String testName); @Override void delete(String testName); @Override void clear(); }
SiberiSQLStorage extends SQLiteOpenHelper implements SiberiStorage { @Override public void insert(String testName, int variant, JSONObject metaData) { ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_NAME, testName); contentValues.put(COLUMN_VARIANT, variant); if(metaData != null) { contentValues.put(COLUMN_META, metaData.toString()); } mDb.insertOrThrow(TABLE_NAME, null, contentValues); } SiberiSQLStorage(Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void insert(String testName, int variant, JSONObject metaData); @Override ExperimentContent select(String testName); @Override void delete(String testName); @Override void clear();  }