18192021222324252627
// execute publisher.publish(message); // verify mockSubscriber.verify(); } }
4647484950515253
ServletActionContext.setRequest(request); CreateSessionInterceptor interceptor = new CreateSessionInterceptor(); interceptor.intercept(new MockActionInvocation()); httpServletRequestMock.verify(); } }
8990919293949596979899
// when... instance.verifyMocks(); // verify... mock1.verify(); mock2.verify(); } public static class HasMockThatFailsVerify extends UsingJMock { { new Mock(Interface.class).expects(once()).method("doStuff").withNoArguments();
110111112113114115116117118119120
} catch (ValidatorException ve) { // suppress it - this is as expected } mock.verify(); } public void testWrongType() { // since the pattern has not been set it will be null
135136137138139140141142143144145
} catch (ValidatorException ve) { // suppress it - this is as expected } mock.verify(); } public void testExactFailure() { // some very basic sanity test
160161162163164165166167168169170
catch (ValidatorException ve) { // if exception then fine. } mock.verify(); } public void testStringBasedValues() { LongRangeValidator validator = new LongRangeValidator();
catch (ValidatorException ve) { // if exception then fine. } mock.verify(); } public void testStringBasedValues() { DoubleRangeValidator validator = new DoubleRangeValidator();
502503504505506507508509510511512
} finally { setFacesContext(null); } mock.verify(); } protected abstract NumberConverter getNumberConverter(); protected abstract void doTestStrictNess(