Package org.easymock.tests

Examples of org.easymock.tests.IMethods.oneArg()


        expect(mock2.oneArg(false)).andReturn("foo");

        replayAll();

        assertNull(mock1.oneArg(true));
        assertNull(mock2.oneArg(true));

        resetAllToStrict();

        expect(mock1.oneArg(false)).andReturn("foo");
        expect(mock1.oneArg(true)).andReturn("foo");
View Full Code Here


        resetAllToStrict();

        expect(mock1.oneArg(false)).andReturn("foo");
        expect(mock1.oneArg(true)).andReturn("foo");
        expect(mock2.oneArg(false)).andReturn("foo");
        expect(mock2.oneArg(true)).andReturn("foo");

        replayAll();

        try {
View Full Code Here

        resetAllToStrict();

        expect(mock1.oneArg(false)).andReturn("foo");
        expect(mock1.oneArg(true)).andReturn("foo");
        expect(mock2.oneArg(false)).andReturn("foo");
        expect(mock2.oneArg(true)).andReturn("foo");

        replayAll();

        try {
            mock1.oneArg(true);
View Full Code Here

            mock1.oneArg(true);
            fail("Should be strict");
        } catch (final AssertionError e) {
        }
        try {
            mock2.oneArg(true);
            fail("Should be strict");
        } catch (final AssertionError e) {
        }

        assertEquals("foo", mock1.oneArg(false));
View Full Code Here

        } catch (final AssertionError e) {
        }

        assertEquals("foo", mock1.oneArg(false));
        assertEquals("foo", mock1.oneArg(true));
        assertEquals("foo", mock2.oneArg(false));
        assertEquals("foo", mock2.oneArg(true));

        verifyAll();
    }
}
View Full Code Here

        }

        assertEquals("foo", mock1.oneArg(false));
        assertEquals("foo", mock1.oneArg(true));
        assertEquals("foo", mock2.oneArg(false));
        assertEquals("foo", mock2.oneArg(true));

        verifyAll();
    }
}
View Full Code Here

    @Test
    public void testThreadSafe() throws Throwable {

        final IMethods mock = createMock(IMethods.class);
        expect(mock.oneArg("test")).andReturn("result").times(THREAD_COUNT);

        replay(mock);

        final Callable<String> replay = new Callable<String>() {
            public String call() throws Exception {
View Full Code Here

        replay(mock);

        final Callable<String> replay = new Callable<String>() {
            public String call() throws Exception {
                return mock.oneArg("test");
            }
        };

        final ExecutorService service = Executors.newFixedThreadPool(THREAD_COUNT);
View Full Code Here

    @Test
    public void testThreadNotSafe() throws Throwable {

        final IMethods mock = createMock(IMethods.class);
        expect(mock.oneArg("test")).andReturn("result").times(THREAD_COUNT);

        makeThreadSafe(mock, false);

        checkIsUsedInOneThread(mock, true);
View Full Code Here

        replay(mock);

        final Callable<String> replay = new Callable<String>() {
            public String call() throws Exception {
                return mock.oneArg("test");
            }
        };

        final ExecutorService service = Executors.newFixedThreadPool(THREAD_COUNT);
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.