expect(consumer.receive(anyObject(TestContext.class), anyLong())).andReturn(message).once();
expect(endpoint.getActor()).andReturn(null).anyTimes();
replay(endpoint, consumer, endpointConfiguration);
PayloadTemplateMessageBuilder controlMessageBuilder = new PayloadTemplateMessageBuilder();
XmlMessageValidationContext validationContext = new XmlMessageValidationContext();
validationContext.setMessageBuilder(controlMessageBuilder);
controlMessageBuilder.setPayloadData("<root>"
+ "<element attributeA='attribute-value' attributeB='attribute-value' >"
+ "<sub-elementA attribute='A'>text-value</sub-elementA>"
+ "<sub-elementB attribute='B'>text-value</sub-elementB>"
+ "<sub-elementC attribute='C'>text-value</sub-elementC>"
+ "</element>"
+ "</root>");
context.getVariables().put("variableA", "header-valueA");
context.getVariables().put("variableB", "header-valueB");
context.getVariables().put("variableC", "header-valueC");
HashMap<String, Object> validateHeaderValues = new HashMap<String, Object>();
validateHeaderValues.put("${variableA}", "A");
validateHeaderValues.put("${variableB}", "B");
validateHeaderValues.put("${variableC}", "C");
controlMessageBuilder.setMessageHeaders(validateHeaderValues);
List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
validationContexts.add(validationContext);
receiveMessageBean.setValidationContexts(validationContexts);
receiveMessageBean.execute(context);