Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Add R import in tests;removes migration test (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
konishon committed Nov 6, 2019
1 parent 7c52491 commit 983627f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import net.bytebuddy.utility.RandomString;

import org.bcss.collect.android.R;
import org.hamcrest.Matcher;
import org.junit.BeforeClass;
import org.junit.ClassRule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import androidx.test.rule.ActivityTestRule;
import androidx.test.rule.GrantPermissionRule;

import org.bcss.collect.android.R;
import org.javarosa.form.api.FormEntryPrompt;
import org.junit.AfterClass;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,6 @@ public static Iterable<Object[]> data() {
});
}

@Test
public void testMigration() throws IOException {
copyFileFromAssets("database" + File.separator + dbFilename, DATABASE_PATH);
FormsDatabaseHelper databaseHelper = new FormsDatabaseHelper();
ensureMigrationAppliesFully(databaseHelper);

SQLiteDatabase db = databaseHelper.getReadableDatabase();
assertThat(db.getVersion(), is(FormsDatabaseHelper.DATABASE_VERSION));

List<String> newColumnNames = SQLiteUtils.getColumnNames(db, FORMS_TABLE_NAME);

assertThat(newColumnNames, contains(FormsDatabaseHelper.CURRENT_VERSION_COLUMN_NAMES));

if (action.equals(UPGRADE)) {
assertThatFormsAreKeptAfterUpgrading();
}
}

private void assertThatFormsAreKeptAfterUpgrading() {
FormsDao formsDao = new FormsDao();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class FormsDatabaseHelper extends SQLiteOpenHelper {
public static final String FORMS_TABLE_NAME = "forms";
public static final String DATABASE_PATH = Collect.METADATA_PATH + File.separator + DATABASE_NAME;

private static final int DATABASE_VERSION = 8;
public static final int DATABASE_VERSION = 8;

// These exist in database versions 2 and 3, but not in 4...
private static final String TEMP_FORMS_TABLE_NAME = "forms_v4";
Expand Down

0 comments on commit 983627f

Please sign in to comment.