Package org.mongolink.test.entity

Examples of org.mongolink.test.entity.FakeChildAggregate


    }

    @Test
    public void savesChildEntityInSameCollection() {
        FakeChildAggregate fakeChildEntity = new FakeChildAggregate();
        fakeChildEntity.setId("2");

        session.save(fakeChildEntity);
        session.flush();

        assertThat(entities().count()).isEqualTo(1L);
View Full Code Here


        dbo.put("_id", "good id");
        dbo.put("value", "this is a value");
        dbo.put("childName", "this is a name");
        dbo.put("__discriminator", "FakeChildAggregate");

        FakeChildAggregate entity = (FakeChildAggregate) parrentMapper.toInstance(dbo);

        assertThat(entity, notNullValue());
        assertThat(entity.getId(), is("good id"));
        assertThat(entity.getValue(), is("this is a value"));
        assertThat(entity.getChildName(), is("this is a name"));
    }
View Full Code Here

        assertThat(entity, instanceOf(FakeChildAggregate.class));
    }

    @Test
    public void canSaveFromParentMapper() {
        FakeChildAggregate fakeChildEntity = new FakeChildAggregate();
        fakeChildEntity.setChildName("test");

        DBObject dbObject = context.mapperFor(FakeAggregate.class).toDBObject(fakeChildEntity);

        assertThat((String) dbObject.get("__discriminator"), is("FakeChildAggregate"));
    }
View Full Code Here

        createContext();
    }

    @Test
    public void canSaveSubclass() {
        FakeChildAggregate entity = new FakeChildAggregate();
        entity.setValue("this is a value");
        entity.setId("5d9d9b5e36a9a4265ea9ecbe");
        entity.setChildName("this is a name");

        DBObject dbObject = parrentMapper.toDBObject(entity);

        assertThat(dbObject, notNullValue());
        assertThat((String) dbObject.get("value"), is("this is a value"));
View Full Code Here

TOP

Related Classes of org.mongolink.test.entity.FakeChildAggregate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.