Package org.jmock.integration.junit4

Examples of org.jmock.integration.junit4.JUnit4Mockery.assertIsSatisfied()


            setThreadingPolicy(new Synchroniser());
        }};
        FrameworkMethod method = createMethodWithExpectations(context);
        Statement statement = createStatementWithExpectations(context);
        new RunConcurrently(method, statement).evaluate();
        context.assertIsSatisfied();
    }

    private FrameworkMethod createMethodWithExpectations(Mockery context) {
        final FrameworkMethod method = context.mock(FrameworkMethod.class);
        context.checking(new Expectations() {{
View Full Code Here


            oneOf(worker).togglePause(pause);
        }});
        final PauseCommand pauseCmd = new PauseCommand(pause);
        pauseCmd.setWorker(worker);
        pauseCmd.run();
        mockCtx.assertIsSatisfied();
    }
}
View Full Code Here

            oneOf(worker).end(shutdown);
        }});
        final ShutdownCommand shutdownCmd = new ShutdownCommand(shutdown);
        shutdownCmd.setWorker(worker);
        shutdownCmd.run();
        mockCtx.assertIsSatisfied();
    }
}
View Full Code Here

        mockCtx.checking(new Expectations(){{
            allowing(jobEx).isShutdown(); will(returnValue(false));
        }});
        Assert.assertEquals(RecoveryStrategy.PROCEED,
            new DefaultExceptionHandler().onException(jobEx, new InterruptedException("foo"), null));
        mockCtx.assertIsSatisfied();
    }

    @Test
    public void testOnException_InterruptedShutdown() {
        final Mockery mockCtx = new JUnit4Mockery();
View Full Code Here

        mockCtx.checking(new Expectations(){{
            allowing(jobEx).isShutdown(); will(returnValue(true));
        }});
        Assert.assertEquals(RecoveryStrategy.TERMINATE,
            new DefaultExceptionHandler().onException(jobEx, new InterruptedException("foo"), null));
        mockCtx.assertIsSatisfied();
    }

    @Test
    public void testOnException_OtherEx() {
        Assert.assertEquals(RecoveryStrategy.TERMINATE,
View Full Code Here

                will(throwException(new PersistenceException()));
            }
        });

        assertFalse(sut.execute(TEST_PERSON_ID_1, TEST_GROUP_ID_1));
        mockContext.assertIsSatisfied();
    }
}
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.