@Override public void onCreate() { super.onCreate(); application = this; Nammu.init(this); /* * Configure Realm */ Realm.init(this); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(realmConfiguration); try { DataStore.getInstance(); } catch (RealmError e) { Log.e(TAG, "Error configuring realm, deleting and trying again.", e); Realm.deleteRealm(realmConfiguration); DataStore.getInstance(); } }
@Test public void renameTable_tableNotExist() { sharedRealm.beginTransaction(); assertFalse(sharedRealm.hasTable("TableToRemove")); thrown.expect(RealmError.class); sharedRealm.renameTable("TableToRemove", "newName"); sharedRealm.cancelTransaction(); }