Skip to content

Commit

Permalink
Fixes #132 to use US locale for testing with bindy.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 24, 2018
1 parent 604a789 commit 16c2f7f
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package camelinaction.bindy;

import java.math.BigDecimal;
import java.util.Locale;

import junit.framework.TestCase;
import org.apache.camel.CamelContext;
Expand All @@ -13,18 +14,35 @@

public class PurchaseOrderBindyTest extends TestCase {

private Locale locale;

@Override
protected void setUp() throws Exception {
super.setUp();
// use US locale for testing so we use dot as decimal in the price
locale = Locale.getDefault();
Locale.setDefault(Locale.US);
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
// restore back
Locale.setDefault(locale);
}

@Test
public void testBindy() throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(createRoute());
context.start();

MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.expectedBodiesReceived("Camel in Action,39.95,1\n");
mock.expectedBodiesReceived("Camel in Action,69.99,1\n");

PurchaseOrder order = new PurchaseOrder();
order.setAmount(1);
order.setPrice(new BigDecimal("39.95"));
order.setPrice(new BigDecimal("69.99"));
order.setName("Camel in Action");

ProducerTemplate template = context.createProducerTemplate();
Expand Down

0 comments on commit 16c2f7f

Please sign in to comment.