protected void setUp() throws Exception {
// Override testService in test case.
_testService = context.mock(TestService.class);
// We use one partner to simulate failing service and receive message upon process completion.
final MessageExchangeContext partner = context.mock(MessageExchangeContext.class);
// Some processes will complete, but not all.
context.checking(new Expectations() {{
atMost(1).of(partner).invokePartner(with(aMexWithOpnameIs("respond"))); will(new CustomAction("process completed") {
public Object invoke(org.jmock.api.Invocation invocation) throws Throwable {
_testService.completed();