use of dev.morphia.test.models.SpecializedEntity in project morphia by mongodb.
the class TestGenerics method testGenericEntities.
@Test
public void testGenericEntities() {
EntityModel entityModel = getMapper().map(SpecializedEntity.class).get(0);
PropertyModel test = entityModel.getProperty("test");
assertEquals(test.getType(), UUID.class);
SpecializedEntity beforeDB = new SpecializedEntity();
beforeDB.setId(UUID.randomUUID());
beforeDB.setTest(UUID.randomUUID());
getDs().save(beforeDB);
SpecializedEntity loaded = getDs().find(SpecializedEntity.class).filter(eq("_id", beforeDB.getId())).first();
assertEquals(loaded.getId(), beforeDB.getId());
assertEquals(loaded.getTest(), beforeDB.getTest());
}
Aggregations