Package org.jongo.model

Examples of org.jongo.model.ExternalFriend


    }

    @Test
    public void canInsertAPojoWithACustomId() throws Exception {

        collection.withWriteConcern(WriteConcern.SAFE).insert(new ExternalFriend(122, "value"));

        ExternalFriend result = collection.findOne("{name:'value'}").as(ExternalFriend.class);
        assertThat(result.getId()).isEqualTo(122);
    }
View Full Code Here


    }

    @Test
    public void canOnlyInsertOnceAPojoWithACustomId() throws Exception {

        collection.withWriteConcern(WriteConcern.SAFE).insert(new ExternalFriend(122, "value"));

        try {
            collection.withWriteConcern(WriteConcern.SAFE).insert(new ExternalFriend(122, "other value"));
            Assert.fail();
        } catch (MongoException.DuplicateKey e) {
        }
    }
View Full Code Here

TOP

Related Classes of org.jongo.model.ExternalFriend

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.