use of org.apache.camel.dataformat.jibx.model.PurchaseOrder in project camel by apache.
the class JibxDataFormatUnmarshallFail method testUnmarshallFail.
@Test(expected = CamelExecutionException.class)
public void testUnmarshallFail() throws InterruptedException, ParserConfigurationException, IOException, SAXException {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
String name = "foo";
double price = 1;
double amount = 2;
String purchaseOrderXml = String.format("<order name='%s' price='%s' amount='%s' />", name, price + "", amount + "");
template.sendBody("direct:start", purchaseOrderXml);
assertMockEndpointsSatisfied();
PurchaseOrder body = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder.class);
assertEquals(name, body.getName());
assertEquals(price, body.getPrice(), 1);
assertEquals(amount, body.getAmount(), 1);
}
use of org.apache.camel.dataformat.jibx.model.PurchaseOrder in project camel by apache.
the class JibxDataFormatUnmarshallWithBindingNameTest method testUnmarshallWithBindingName.
@Test
public void testUnmarshallWithBindingName() throws InterruptedException, ParserConfigurationException, IOException, SAXException {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
String name = "foo";
double price = 1;
double amount = 2;
String purchaseOrderXml = String.format("<order name='%s' price='%s' amount='%s' />", name, price + "", amount + "");
template.sendBody("direct:start", purchaseOrderXml);
assertMockEndpointsSatisfied();
PurchaseOrder body = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder.class);
assertEquals(name, body.getName());
assertEquals(price, body.getPrice(), 1);
assertEquals(amount, body.getAmount(), 1);
}
Aggregations