Assert.assertEquals(doc1, doc2);
}
@Test(dependsOnMethods = "testCreate")
public void nonPolymorphicQuery() {
final ORecordAbstract newAccount = new ODocument("Account").field("name", "testInheritanceName").save();
List<ODocument> allResult = database.query(new OSQLSynchQuery<ODocument>("select from Account"));
List<ODocument> superClassResult = database
.query(new OSQLSynchQuery<ODocument>("select from Account where @class = 'Account'"));
List<ODocument> subClassResult = database.query(new OSQLSynchQuery<ODocument>("select from Company where @class = 'Company'"));
Assert.assertTrue(allResult.size() != 0);
Assert.assertTrue(superClassResult.size() != 0);
Assert.assertTrue(subClassResult.size() != 0);
// VERIFY ALL THE SUBCLASS RESULT ARE NOT CONTAINED IN SUPERCLASS RESULT
for (ODocument d : subClassResult) {
Assert.assertFalse(superClassResult.contains(d));
}
HashSet<ODocument> browsed = new HashSet<ODocument>();
for (ODocument d : database.browseClass("Account")) {
Assert.assertFalse(browsed.contains(d));
browsed.add(d);
}
newAccount.delete();
}