use of io.realm.entities.AllTypes in project realm-java by realm.
the class RealmJsonTests method createObjectFromJson_streamDecimal128AsDouble.
@Test
public void createObjectFromJson_streamDecimal128AsDouble() throws IOException {
assumeThat(Build.VERSION.SDK_INT, greaterThanOrEqualTo(Build.VERSION_CODES.HONEYCOMB));
InputStream in = TestHelper.loadJsonFromAssets(context, "decimal128_as_double.json");
realm.beginTransaction();
realm.createObjectFromJson(AllTypes.class, in);
realm.commitTransaction();
in.close();
AllTypes obj = realm.where(AllTypes.class).findFirst();
assertEquals(Decimal128.parse("0.30000001192092896"), obj.getColumnDecimal128());
}
use of io.realm.entities.AllTypes in project realm-java by realm.
the class OrderedRealmCollectionSnapshotTests method populateRealm.
private void populateRealm(Realm realm, int testSize) {
realm.beginTransaction();
for (int i = 0; i < testSize; i++) {
AllTypes allTypes = realm.createObject(AllTypes.class);
allTypes.setColumnLong(i);
}
realm.commitTransaction();
}
use of io.realm.entities.AllTypes in project realm-java by realm.
the class RealmJsonTests method createObjectFromJson_decimal128AsInt.
@Test
public void createObjectFromJson_decimal128AsInt() throws JSONException {
JSONObject json = new JSONObject();
json.put("columnDecimal128", -42);
realm.beginTransaction();
realm.createObjectFromJson(AllTypes.class, json);
realm.commitTransaction();
AllTypes obj = realm.where(AllTypes.class).findFirst();
assertEquals(new Decimal128(-42), obj.getColumnDecimal128());
}
use of io.realm.entities.AllTypes in project realm-java by realm.
the class RealmListTests method set_managedObjectInUnmanagedMode.
@Test
public void set_managedObjectInUnmanagedMode() {
RealmList<AllTypes> list = new RealmList<AllTypes>();
list.add(new AllTypes());
realm.beginTransaction();
AllTypes managedAllTypes = realm.createObject(AllTypes.class);
realm.commitTransaction();
list.set(0, managedAllTypes);
assertEquals(managedAllTypes, list.get(0));
}
use of io.realm.entities.AllTypes in project realm-java by realm.
the class RealmTests method copyFromRealm_list_invalidListThrows.
@Test
public void copyFromRealm_list_invalidListThrows() {
realm.beginTransaction();
AllTypes object = realm.createObject(AllTypes.class);
List<AllTypes> list = new RealmList<AllTypes>(object);
object.deleteFromRealm();
realm.commitTransaction();
thrown.expect(IllegalArgumentException.class);
realm.copyFromRealm(list);
}
Aggregations