final QName inType = new QName("fromA");
final QName expectedDestType = new QName("toB");
final String input = "Hello";
// Provide the service
MockHandler provider = new MockHandler();
ServiceReference service = _domain.createInOnlyService(serviceName, provider);
// Create the exchange and invoke the service
MockHandler invokerHandler = new MockHandler();
Exchange exchange = service.createExchange(invokerHandler);
// Set the from and to message names. NOTE: setting to the to message
// name will not be necessary once the service definition is available
// at runtime
Message msg = exchange.createMessage().setContent(input);
TransformSequence.
from(inType).
to(expectedDestType).
associateWith(msg);
msg.setContent(input);
exchange.send(msg);
invokerHandler.waitForFaultMessage();
Object content = invokerHandler.getFaults().poll().getMessage().getContent();
Assert.assertTrue(content instanceof HandlerException);
String testString = "Transformations not applied. Required payload type of 'toB'. Actual payload type is 'fromA'. You must define and register a Transformer to transform between these types.";
boolean transformsApplied = ((HandlerException)content).getMessage().contains(testString);
Assert.assertTrue(transformsApplied);
}