Example #1
0
 // Test min on empty columns
 public void testMinValueForEmptyColumns() {
   RealmResults<NullTypes> results = testRealm.where(NullTypes.class).findAll();
   assertNull(results.min(NullTypes.FIELD_INTEGER_NOT_NULL));
   assertNull(results.min(NullTypes.FIELD_FLOAT_NOT_NULL));
   assertNull(results.min(NullTypes.FIELD_DOUBLE_NOT_NULL));
   assertNull(results.minDate(NullTypes.FIELD_DATE_NOT_NULL));
 }
Example #2
0
  // Test min on nullable rows with partial null values
  public void testMinValueForPartialNullRows() {
    populatePartialNullRowsForNumericTesting();

    RealmResults<NullTypes> results = testRealm.where(NullTypes.class).findAll();
    assertEquals(0, results.min(NullTypes.FIELD_INTEGER_NULL).intValue());
    assertEquals(0f, results.min(NullTypes.FIELD_FLOAT_NULL).floatValue(), 0f);
    assertEquals(0d, results.min(NullTypes.FIELD_DOUBLE_NULL).doubleValue(), 0d);
  }
Example #3
0
  public void testMinValueIsMinValue() {
    RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll();

    Number minimum = resultList.min(FIELD_LONG);
    assertEquals(0, minimum.intValue());
  }