query.descend("fId").constrain(Long.valueOf(preference.getId())); //$NON-NLS-1$
List<IPreference> result = query.execute();
assertEquals(1, result.size());
IPreference otherPreference = result.get(0);
assertEquals(preference.getKey(), otherPreference.getKey());
if ("string".equals(preference.getKey()))
assertEquals(preference.getString(), otherPreference.getString());
if ("strings".equals(preference.getKey()))
assertTrue(Arrays.equals(preference.getStrings(), otherPreference.getStrings()));
if ("boolean".equals(preference.getKey()))
assertEquals(preference.getBoolean(), otherPreference.getBoolean());
if ("booleans".equals(preference.getKey()))
assertTrue(Arrays.equals(preference.getBooleans(), otherPreference.getBooleans()));
if ("integer".equals(preference.getKey()))
assertEquals(preference.getInteger(), otherPreference.getInteger());
if ("integers".equals(preference.getKey()))
assertTrue(Arrays.equals(preference.getIntegers(), otherPreference.getIntegers()));
if ("long".equals(preference.getKey()))
assertEquals(preference.getLong(), otherPreference.getLong());
if ("longs".equals(preference.getKey()))
assertTrue(Arrays.equals(preference.getLongs(), otherPreference.getLongs()));
}
/* Assert Label */
List<ILabel> labels = db.query(ILabel.class);
assertEquals(labels.size(), defragmentedDb.query(ILabel.class).size());