Source:
<code><START> public void offlineClientReset() throws IOException { <END> SyncConfiguration config = configFactory .createSyncConfigurationBuilder(SyncTestUtils.createTestUser(), "<LINK_0>") .modules(new StringOnlyModule()) .build(); String path = config.getPath(); File realmFile = new File (path); assertFalse(realmFile.exists()); configFactory.copyRealmFromAssets(InstrumentationRegistry.getContext(), "sync-1.x.realm", config); assertTrue(realmFile.exists()); try { Realm.getInstance(config); fail("should throw IncompatibleSyncedFileException"); } catch (IncompatibleSyncedFileException expected) { String recoveryPath = expected.getRecoveryPath(); assertTrue(new File(recoveryPath).exists()); RealmConfiguration backupRealmConfiguration = expected.getBackupRealmConfiguration(null, new StringOnlyModule()); Realm backupRealm = Realm.getInstance(backupRealmConfiguration); assertFalse(backupRealm.isEmpty()); RealmResults<StringOnly> all = backupRealm.where(StringOnly.class).findAll(); assertEquals(1, all.size()); assertEquals("Hello from ROS 1.X", all.get(0).getChars()); try { backupRealm.beginTransaction(); fail("Backup Realm should be read-only, we should throw"); } catch (IllegalStateException e) { } backupRealm.close(); DynamicRealm dynamicRealm = DynamicRealm.getInstance(backupRealmConfiguration); dynamicRealm.getSchema().checkHasTable(StringOnly.CLASS_NAME, "Dynamic Realm should contains " + StringOnly.CLASS_NAME); RealmResults<DynamicRealmObject> allDynamic = dynamicRealm.where(StringOnly.CLASS_NAME).findAll(); assertEquals(1, allDynamic.size()); assertEquals("Hello from ROS 1.X", allDynamic.first().getString(StringOnly.FIELD_CHARS)); dynamicRealm.close(); } Realm realm = Realm.getInstance(config); assertTrue(realm.isEmpty()); }</code><technical_language>this stableIDMigrationCauseClientReset? remove stableIDMigrationCauseClientReset</technical_language>

Target:
public void offlineClientReset() throws IOException { SyncConfiguration config = configFactory .createSyncConfigurationBuilder(SyncTestUtils.createTestUser(), "<LINK_0>") .modules(new StringOnlyModule()) .build(); String path = config.getPath(); File realmFile = new File (path); assertFalse(realmFile.exists()); configFactory.copyRealmFromAssets(InstrumentationRegistry.getContext(), "sync-1.x.realm", config); assertTrue(realmFile.exists()); try { Realm.getInstance(config); fail("should throw IncompatibleSyncedFileException"); } catch (IncompatibleSyncedFileException expected) { String recoveryPath = expected.getRecoveryPath(); assertTrue(new File(recoveryPath).exists()); RealmConfiguration backupRealmConfiguration = expected.getBackupRealmConfiguration(null, new StringOnlyModule()); Realm backupRealm = Realm.getInstance(backupRealmConfiguration); assertFalse(backupRealm.isEmpty()); RealmResults<StringOnly> all = backupRealm.where(StringOnly.class).findAll(); assertEquals(1, all.size()); assertEquals("Hello from ROS 1.X", all.get(0).getChars()); try { backupRealm.beginTransaction(); fail("Backup Realm should be read-only, we should throw"); } catch (IllegalStateException ignored) { } backupRealm.close(); DynamicRealm dynamicRealm = DynamicRealm.getInstance(backupRealmConfiguration); dynamicRealm.getSchema().checkHasTable(StringOnly.CLASS_NAME, "Dynamic Realm should contains " + StringOnly.CLASS_NAME); RealmResults<DynamicRealmObject> allDynamic = dynamicRealm.where(StringOnly.CLASS_NAME).findAll(); assertEquals(1, allDynamic.size()); assertEquals("Hello from ROS 1.X", allDynamic.first().getString(StringOnly.FIELD_CHARS)); dynamicRealm.close(); } Realm realm = Realm.getInstance(config); assertTrue(realm.isEmpty()); realm.close(); }