updated database version and added associated tests
This commit is contained in:
Ashish Kumar 2019-02-28 22:44:36 +05:30 committed by Josephine Lim
parent ab4fca5ea9
commit 1b86726364
2 changed files with 10 additions and 1 deletions

View file

@ -14,7 +14,7 @@ import fr.free.nrw.commons.modifications.ModifierSequenceDao;
public class DBOpenHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "commons.db";
private static final int DATABASE_VERSION = 9;
private static final int DATABASE_VERSION = 10;
/**
* Do not use directly - @Inject an instance where it's needed and let

View file

@ -126,6 +126,15 @@ class ContributionDaoTest {
}
}
@Test
fun migrateTableVersionFrom_v9_to_v10() {
Table.onUpdate(database, 8, 9)
// Table changed in version 9
inOrder(database) {
verify<SQLiteDatabase>(database).execSQL(Table.ADD_WIKI_DATA_ENTITY_ID_FIELD)
}
}
@Test
fun saveNewContribution_nonNullFields() {
whenever(client.insert(isA(), isA())).thenReturn(contentUri)