Examples of Fox


Examples of org.jongo.model.Fox

    }

    @Test
    public void canMarshall() {

        BsonDocument doc = engine.marshall(new Fox("fantastic", "roux"));

        DBObject dbo = doc.toDBObject();
        assertThat(dbo.get("_class")).isEqualTo("org.jongo.model.Fox");
        assertThat(dbo.get("name")).isEqualTo("fantastic");
        assertThat(dbo.get("color")).isEqualTo("roux");
View Full Code Here

Examples of org.jongo.model.Fox

    @Test
    public void shouldRespectJsonPublicViewOnMarshall() throws Exception {

        JacksonEngine custom = createProcessorWithView(Views.Public.class);
        Fox vixen = new Fox("fantastic", "roux");
        vixen.setGender("female");

        BsonDocument doc = custom.marshall(vixen);

        DBObject result = doc.toDBObject();
        assertThat(result.get("gender")).isNull();
View Full Code Here

Examples of org.jongo.model.Fox

    @Test
    public void shouldRespectJsonPrivateViewOnMarshall() throws Exception {

        JacksonEngine custom = createProcessorWithView(Views.Private.class);
        Fox vixen = new Fox("fantastic", "roux");
        vixen.setGender("female");

        BsonDocument doc = custom.marshall(vixen);

        DBObject result = doc.toDBObject();
        assertThat(result.get("_class")).isEqualTo("org.jongo.model.Fox");
View Full Code Here

Examples of org.jongo.model.Fox

    public void respectsJsonPublicViewOnUnmarshall() throws Exception {

        BsonDocument doc = bsonify("{'_class':'org.jongo.model.Fox','name':'fantastic','color':'roux','gender':'female'}");
        JacksonEngine custom = createProcessorWithView(Views.Public.class);

        Fox fox = custom.unmarshall(doc, Fox.class);

        assertThat(fox.getGender()).isNull();
    }
View Full Code Here

Examples of org.jongo.model.Fox

    public void respectsJsonPrivateViewOnUnmarshall() throws Exception {

        BsonDocument doc = bsonify("{'_class':'org.jongo.model.Fox','name':'fantastic','color':'roux','gender':'female'}");
        JacksonEngine custom = createProcessorWithView(Views.Private.class);

        Fox fox = custom.unmarshall(doc, Fox.class);

        assertThat(fox.getGender()).isEqualTo("female");
    }
View Full Code Here

Examples of org.jongo.model.Fox

        dropCollection("friends");
    }

    @Test
    public void canFindInheritedEntity() throws IOException {
        collection.save(new Fox("fantastic", "roux"));

        Animal animal = collection.findOne("{name:'fantastic'}").as(Animal.class);

        assertThat(animal).isInstanceOf(Fox.class);
        assertThat(animal.getId()).isNotNull();
View Full Code Here

Examples of org.jongo.model.Fox

    }

    @Test
    public void canUpdateIdFieldOnSuperType() throws IOException {

        Fox fox = new Fox("fantastic", "roux");

        collection.save(fox);

        Animal result = collection.findOne().as(Fox.class);
        assertThat(fox.getId()).isNotNull();
        assertThat(result.getId()).isEqualTo(fox.getId());
    }
View Full Code Here

Examples of org.jongo.model.Fox

    }

    @Test
    public void canHandleInheritanceInASubDocument() throws Exception {

        collection.save(new Zoo("Vincennes", new Fox("Zorro", "roux")));

        Zoo zoo = collection.findOne().as(Zoo.class);
        assertThat(zoo).isNotNull();
        assertThat(zoo.mascot.getName()).isEqualTo("Zorro");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.