EasyMock.expect(message.get(FaultMode.class)).andReturn(faultMode).anyTimes();
EasyMock.expect(exchange.getOutMessage()).andReturn(message);
exchange.put(FaultMode.class, faultMode);
EasyMock.expectLastCall();
EasyMock.expect(exchange.get(FaultMode.class)).andReturn(faultMode).anyTimes();
MessageHandlingTimeRecorder mhtr = EasyMock.createMock(MessageHandlingTimeRecorder.class);
mhtr.endHandling();
EasyMock.expectLastCall();
mhtr.setFaultMode(faultMode);
EasyMock.expectLastCall();
EasyMock.replay(mhtr);
EasyMock.expect(exchange.get(MessageHandlingTimeRecorder.class)).andReturn(mhtr);
EasyMock.replay(exchange);