Examples of MockObject


Examples of com.volantis.testtools.mock.MockObject

    public boolean matches(Object object) {
        if (!(object instanceof MockObject)) {
            return false;
        }

        MockObject mock = (MockObject) object;
        String mockIdentifier = mock._getIdentifier();
        return _mockedClass.isInstance(object)
                && (mockIdentifier == null || mockIdentifier.equals(_identifier));
    }
View Full Code Here

Examples of com.volantis.testtools.mock.MockObject

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        final MockObject equalsMock = createUncheckingMock();

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        doTestUncheckingMock(equalsMock);
View Full Code Here

Examples of com.volantis.testtools.mock.MockObject

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        final MockObject mock = createCheckingMock();

        // =====================================================================
        //   Set Expectations
        // =====================================================================
View Full Code Here

Examples of com.volantis.testtools.mock.MockObject

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        final MockObject mock = createCheckingMock();

        // =====================================================================
        //   Test Expectations
        // =====================================================================
View Full Code Here

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

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

    @Test
    public void testIncludes() {
        MockObject o = new MockObject("string", 10);
        o.longs = 20l;
        coll.save(o);
        MockObject result = coll.findOne(DBQuery.empty(),
                DBProjection.include("string", "integer"));
        assertThat(result.string, equalTo("string"));
        assertThat(result.integer, equalTo(10));
        assertNull(result.longs);
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertNull(result.longs);
    }

    @Test
    public void testExcludes() {
        MockObject o = new MockObject("string", 10);
        o.longs = 20l;
        coll.save(o);
        MockObject result = coll.findOne(DBQuery.empty(),
                DBProjection.exclude("string", "integer"));
        assertNull(result.string);
        assertNull(result.integer);
        assertThat(result.longs, equalTo(20l));
    }
View Full Code Here

Examples of org.mongojack.mock.MockObject

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

    @Test
    public void testQuery() {
        MockObject o1 = new MockObject("1", "ten", 10);
        MockObject o2 = new MockObject("2", "ten", 10);
        coll.insert(o1, o2, new MockObject("twenty", 20));

        List<MockObject> results = coll
                .find(new BasicDBObject("string", "ten")).toArray();
        assertThat(results, hasSize(2));
        assertThat(results, contains(o1, o2));
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertThat(results, contains(o1, o2));
    }

    @Test
    public void testQueryWithLimitedKeys() {
        coll.insert(new MockObject("ten", 10));
        coll.insert(new MockObject("ten", 100));
        coll.insert(new MockObject("twenty", 20));

        List<MockObject> results = coll.find(
                new BasicDBObject("string", "ten"),
                new BasicDBObject("string", "something not null")).toArray();
        assertThat(results, hasSize(2));
View Full Code Here

Examples of org.mongojack.mock.MockObject

        assertThat(results.get(1).string, equalTo("ten"));
    }

    @Test
    public void testRemove() {
        coll.insert(new MockObject("ten", 10));
        coll.insert(new MockObject("ten", 100));
        MockObject object = new MockObject("1", "twenty", 20);
        coll.insert(object);

        coll.remove(new BasicDBObject("string", "ten"));

        List<MockObject> remaining = coll.find().toArray();
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.