Examples of MockObject


Examples of org.mongojack.mock.MockObject

        assertEquals(object.booleans, result.booleans);
    }

    @Test
    public void testInsertRetrieveDate() {
        MockObject object = new MockObject();
        object.date = new Date(10000);
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.date, result.date);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.date, result.date);
    }

    @Test
    public void testDateIsStoredAsBsonDate() {
        MockObject object = new MockObject();
        object.date = new Date(10000);
        coll.insert(object);
        DBObject result = coll.getDbCollection().findOne();
        assertEquals(object.date, result.get("date"));
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.date, result.get("date"));
    }

    @Test
    public void testInsertRetrieveEmptyList() {
        MockObject object = new MockObject();
        object.simpleList = Collections.emptyList();
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.simpleList, result.simpleList);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.simpleList, result.simpleList);
    }

    @Test
    public void testInsertRetrievePopulatedSimpleList() {
        MockObject object = new MockObject();
        object.simpleList = Arrays.asList("1", "2");
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.simpleList, result.simpleList);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.simpleList, result.simpleList);
    }

    @Test
    public void testInsertRetrievePopulatedComplexList() {
        MockObject object = new MockObject();
        MockEmbeddedObject o1 = new MockEmbeddedObject();
        o1.value = "o1";
        MockEmbeddedObject o2 = new MockEmbeddedObject();
        o2.value = "o2";
        object.complexList = Arrays.asList(o1, o2);
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.complexList, result.complexList);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.complexList, result.complexList);
    }

    @Test
    public void testInsertRetrieveEmbeddedObject() {
        MockObject object = new MockObject();
        object.object = new MockEmbeddedObject();
        object.object.value = "blah";
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.object, result.object);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.object, result.object);
    }

    @Test
    public void testInsertRetrieveEmebeddedObjectList() {
        MockObject object = new MockObject();
        object.object = new MockEmbeddedObject();
        object.object.list = Arrays.asList("1", "2");
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.object, result.object);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertEquals(object.object, result.object);
    }

    @Test
    public void testEverything() {
        MockObject object = new MockObject();
        object._id = "theid";
        object.integer = 123;
        object.longs = 1234L;
        object.floats = 12.34f;
        object.doubles = 123.456;
View Full Code Here

Examples of org.mongojack.mock.MockObject

        coll = getCollection(MockObject.class, String.class);
    }

    @Test
    public void testIncByOne() throws Exception {
        coll.insert(new MockObject("blah", "string", 10));
        coll.updateById("blah", DBUpdate.inc("integer"));
        assertThat(coll.findOneById("blah").integer, equalTo(11));
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertThat(coll.findOneById("blah").integer, equalTo(11));
    }

    @Test
    public void testInc() throws Exception {
        coll.insert(new MockObject("blah", "string", 10));
        coll.updateById("blah", DBUpdate.inc("integer", 2));
        assertThat(coll.findOneById("blah").integer, equalTo(12));
    }
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.