Search in sources :

Example 6 with IOSAllTypes

use of io.realm.entities.IOSAllTypes in project realm-java by realm.

the class IOSRealmTests method iOSEncryptedRealm.

@Test
public void iOSEncryptedRealm() throws IOException {
    for (String iosVersion : IOS_VERSIONS) {
        configFactory.copyRealmFromAssets(context, "ios/" + iosVersion + "-alltypes-default-encrypted.realm", REALM_NAME);
        RealmConfiguration realmConfig = configFactory.createConfigurationBuilder().name(REALM_NAME).encryptionKey(getIOSKey()).schema(IOSAllTypes.class, IOSChild.class).build();
        realm = Realm.getInstance(realmConfig);
        IOSAllTypes obj = realm.where(IOSAllTypes.class).findFirst();
        assertFalse(obj.isBoolCol());
        assertEquals(0, obj.getShortCol());
        assertEquals(0, obj.getIntCol());
        assertEquals(0L, obj.getLongCol());
        assertEquals(0.0F, obj.getFloatCol(), 0F);
        assertEquals(0.0D, obj.getDoubleCol(), 0D);
        assertArrayEquals(new byte[0], obj.getByteCol());
        assertEquals("", obj.getStringCol());
        assertEquals(new Date(0), obj.getDateCol());
        assertNull(obj.getChild());
        assertEquals(0, obj.getChildren().size());
    }
}
Also used : IOSAllTypes(io.realm.entities.IOSAllTypes) IOSChild(io.realm.entities.IOSChild) Date(java.util.Date) Test(org.junit.Test)

Aggregations

IOSAllTypes (io.realm.entities.IOSAllTypes)6 Test (org.junit.Test)6 Date (java.util.Date)3 IOSChild (io.realm.entities.IOSChild)2 Table (io.realm.internal.Table)1