BindingMessageInfo bmi = control.createMock(BindingMessageInfo.class);
EasyMock.expect(boi.getOutput()).andReturn(bmi);
exchange.put(BindingOperationInfo.class, boi);
Channel channel = control.createMock(Channel.class);
EasyMock.expect(nmr.createChannel()).andReturn(channel);
Exchange xchg = control.createMock(Exchange.class);
EasyMock.expect(channel.createExchange(Pattern.InOut)).andReturn(xchg);
org.apache.servicemix.nmr.api.Message inMsg = control.createMock(org.apache.servicemix.nmr.api.Message.class);
EasyMock.expect(xchg.getIn()).andReturn(inMsg);
// just need to make sure the customer header is set
inMsg.setHeader("myHeader", "value");
EasyMock.expectLastCall();
EndpointRegistry endpoints = control.createMock(EndpointRegistry.class);
EasyMock.expect(channel.getNMR()).andReturn(nmr);
EasyMock.expect(nmr.getEndpointRegistry()).andReturn(endpoints);
org.apache.servicemix.nmr.api.Message outMsg = control.createMock(org.apache.servicemix.nmr.api.Message.class);
EasyMock.expect(xchg.getOut()).andReturn(outMsg);
Source source = new StreamSource(new ByteArrayInputStream(
"<message>TestHelloWorld</message>".getBytes()));
EasyMock.expect(outMsg.getBody(Source.class)).andReturn(source);
EasyMock.expect(xchg.getOut()).andReturn(outMsg);
EasyMock.expect(outMsg.getAttachments()).andReturn(new HashMap<String, Object>());
EasyMock.expect(outMsg.getHeaders()).andReturn(new HashMap<String, Object>());
control.replay();
try {
conduit.prepare(message);