PayloadTemplateMessageBuilder extends AbstractMessageContentBuilder { public void setPayloadData(String payloadData) { this.payloadData = payloadData; }  @Override Object buildMessagePayload(TestContext context, String messageType); void setPayloadData(String payloadData); void setPayloadResourcePath(String payloadResource); String getPayloadResourcePath(); String getPayloadData(); String getPayloadResourceCharset(); void setPayloadResourceCharset(String payloadResourceCharset);  }
@Test public void testMessageBuilderVariableSupport() { messageBuilder.setPayloadData("This ${placeholder} contains variables!"); context.setVariable("placeholder", "payload data"); Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusSettings.DEFAULT_MESSAGE_TYPE); assertEquals(resultingMessage.getPayload(), "This payload data contains variables!"); }
@Test public void testVariablesInMessagePayloadsAreReplaced(){ context.setVariable("name", "Frauke"); messageBuilder.setPayloadData(initialVariableTestPayload); final Message message = messageBuilder.buildMessageContent(context, MessageType.JSON.name()); assertEquals(message.getPayload(), resultingVariableTestPayload); }