*/
@Test
public void fxForward() throws JSONException {
ZonedDateTime forwardDate = zdt(2012, 12, 21, 11, 0, 0, 0, ZoneOffset.UTC);
ExternalId regionId = ExternalId.of(ExternalSchemes.FINANCIAL, "GB");
FXForwardSecurity fxForward = new FXForwardSecurity(Currency.USD, 150, Currency.GBP, 100, forwardDate, regionId);
fxForward.setName("GBP/USD forward");
JsonDataSink sink = new JsonDataSink(BlotterUtils.getJsonBuildingConverters());
BeanVisitor<JSONObject> writingVisitor = new BuildingBeanVisitor<>(fxForward, sink);
BeanTraverser traverser = new BeanTraverser(s_propertyFilter);
JSONObject json = (JSONObject) traverser.traverse(FXForwardSecurity.meta(), writingVisitor);
assertNotNull(json);
// System.out.println(json);
JsonBeanDataSource dataSource = new JsonBeanDataSource(new JSONObject(json.toString()));
MetaBeanFactory metaBeanFactory = new MapMetaBeanFactory(ImmutableSet.<MetaBean>of(FXForwardSecurity.meta()));
BeanVisitor<BeanBuilder<Bean>> readingVisitor =
new BeanBuildingVisitor<>(dataSource, metaBeanFactory, BlotterUtils.getBeanBuildingConverters());
BeanBuilder<FXForwardSecurity> beanBuilder =
(BeanBuilder<FXForwardSecurity>) traverser.traverse(FXForwardSecurity.meta(), readingVisitor);
FXForwardSecurity fxForward2 = beanBuilder.build();
assertEquals(fxForward, fxForward2);
}