Package org.mongojack.mock

Examples of org.mongojack.mock.MockObject


        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testRegexPositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().regex("string",
                Pattern.compile("h.llo"));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here


        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testOrPositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().or(DBQuery.is("integer", 9),
                DBQuery.greaterThan("integer", 9),
                DBQuery.lessThan("integer", 9));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testAndPositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().and(
                DBQuery.greaterThan("integer", 9),
                DBQuery.lessThan("integer", 11));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testNorPositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().nor(
                DBQuery.lessThan("integer", 9),
                DBQuery.greaterThan("integer", 11));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testSizePositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().size("simpleList", 3);
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testAllPositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().all("simpleList", "a", "b");
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testElemMatchPositive() throws Exception {
        MockObject mockObject = insertMockObjectWithComplexList();
        DBCursor<MockObject> cursor = coll.find().elemMatch("complexList",
                DBQuery.in("value", "foo", "la").size("list", 3));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testWherePositive() throws Exception {
        MockObject mockObject = insertMockObject();
        DBCursor<MockObject> cursor = coll.find().where("this.integer > 9");
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

        assertThat(cursor.hasNext(), equalTo(false));
    }

    @Test
    public void testSerializationFromDBCursor() throws Exception {
        MockObject mockObject = insertMockObjectWithEmbedded();
        DBCursor<MockObject> cursor = coll.find().is("object",
                mockObject.object);
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

        assertThat(cursor.next(), equalTo(mockObject));
    }

    @Test
    public void testSerializationFromInFind() throws Exception {
        MockObject mockObject = insertMockObjectWithEmbedded();
        DBCursor<MockObject> cursor = coll.find(DBQuery.in("object",
                mockObject.object));
        assertThat(cursor.hasNext(), equalTo(true));
        assertThat(cursor.next(), equalTo(mockObject));
    }
View Full Code Here

TOP

Related Classes of org.mongojack.mock.MockObject

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.