Package net.vz.mongodb.jackson.mock

Examples of net.vz.mongodb.jackson.mock.MockObject


        assertThat(coll.findOneById("blah").integer, equalTo(4 + 8 + 32));
    }

    @Test
    public void testBitwiseAnd() throws Exception {
        coll.insert(new MockObject("blah", "some string", 1 + 4 + 8));
        coll.updateById("blah", DBUpdate.bitwiseAnd("integer", 4 + 8 + 16));
        assertThat(coll.findOneById("blah").integer, equalTo(4 + 8));
    }
View Full Code Here


        assertThat(coll.findOneById("blah").integer, equalTo(4 + 8));
    }

    @Test
    public void testBitwiseOr() throws Exception {
        coll.insert(new MockObject("blah", "some string", 1 + 4 + 8));
        coll.updateById("blah", DBUpdate.bitwiseOr("integer", 4 + 8 + 16));
        assertThat(coll.findOneById("blah").integer, equalTo(1 + 4 + 8 + 16));
    }
View Full Code Here

        assertThat(coll.findOneById("blah").integer, equalTo(1 + 4 + 8 + 16));
    }

    @Test
    public void testObjectSerialisation() throws Exception {
        coll.insert(new MockObject("blah", "some string", 10));
        coll.updateById("blah", DBUpdate.set("object", new MockEmbeddedObject("hello")));
        assertThat(coll.findOneById("blah").object, equalTo(new MockEmbeddedObject("hello")));
    }
View Full Code Here

        assertThat(coll.findOneById("blah").object, equalTo(new MockEmbeddedObject("hello")));
    }

    @Test
    public void testObjectInListSerialisation() throws Exception {
        coll.insert(new MockObject("blah", "some string", 10));
        coll.updateById("blah", DBUpdate.pushAll("complexList", Arrays.asList(new MockEmbeddedObject("hello"))));
        assertThat(coll.findOneById("blah").complexList, hasItem(new MockEmbeddedObject("hello")));
    }
View Full Code Here

        assertThat(coll.findOneById("blah").complexList, hasItem(new MockEmbeddedObject("hello")));
    }

    @Test
    public void testSameOperationTwice() throws Exception {
        coll.insert(new MockObject("blah", "some string", 10));
        coll.updateById("blah", DBUpdate.set("string", "other string").set("integer", 20));
        MockObject updated = coll.findOneById("blah");
        assertThat(updated.string, equalTo("other string"));
        assertThat(updated.integer, equalTo(20));
    }
View Full Code Here

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

    @Test
    public void testInsertNoId() {
        MockObject object = new MockObject();
        coll.insert(object);
        assertNotNull(coll.findOne()._id);
    }
View Full Code Here

        assertNotNull(coll.findOne()._id);
    }

    @Test
    public void testInsertRetrieveAllEmpty() {
        MockObject object = new MockObject();
        object._id = "1";
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object, result);
    }
View Full Code Here

        assertEquals(object, result);
    }

    @Test
    public void testInsertRetrieveString() {
        MockObject object = new MockObject();
        object.string = "a string";
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.string, result.string);
    }
View Full Code Here

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

    @Test
    public void testInsertRetrieveInteger() {
        MockObject object = new MockObject();
        object.integer = 10;
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.integer, result.integer);
    }
View Full Code Here

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

    @Test
    public void testInsertRetrieveLong() {
        MockObject object = new MockObject();
        object.longs = 10L;
        coll.insert(object);
        MockObject result = coll.findOne();
        assertEquals(object.longs, result.longs);
    }
View Full Code Here

TOP

Related Classes of net.vz.mongodb.jackson.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.