Search in sources :

Example 1 with Another

use of dev.morphia.test.models.generics.Another in project morphia by mongodb.

the class TestGenerics method example.

@Test
public void example() {
    ChildEntity entity = new ChildEntity();
    entity.setEmbeddedList(asList(new Child("first"), new Child("second"), new Another("third")));
    getDs().save(entity);
    ChildEntity childEntity = getDs().find(ChildEntity.class).iterator(new FindOptions().limit(1)).next();
    Assert.assertEquals(childEntity, entity);
}
Also used : FindOptions(dev.morphia.query.FindOptions) ChildEntity(dev.morphia.test.models.generics.ChildEntity) Child(dev.morphia.test.models.generics.Child) Another(dev.morphia.test.models.generics.Another) Test(org.testng.annotations.Test)

Aggregations

FindOptions (dev.morphia.query.FindOptions)1 Another (dev.morphia.test.models.generics.Another)1 Child (dev.morphia.test.models.generics.Child)1 ChildEntity (dev.morphia.test.models.generics.ChildEntity)1 Test (org.testng.annotations.Test)1