public void testTrade() {
   SimpleTrade trade = new SimpleTrade();
   trade.setUniqueId(UniqueId.of("A", "B"));
   trade.setQuantity(BigDecimal.valueOf(12.34d));
   trade.setSecurityLink(new SimpleSecurityLink(ExternalId.of("E", "F")));
   trade.setCounterparty(new SimpleCounterparty(ExternalId.of("G", "H")));
   trade.setTradeDate(LocalDate.of(2011, 1, 5));
   trade.setTradeTime(OffsetTime.parse("14:30+02:00"));
   assertEncodeDecodeCycle(Trade.class, trade);
 }
  @SuppressWarnings("deprecation")
  public void testTrade_withPremium() {
    SimpleTrade trade = new SimpleTrade();
    trade.setUniqueId(UniqueId.of("A", "B"));
    trade.setQuantity(BigDecimal.valueOf(12.34d));
    trade.setSecurityLink(new SimpleSecurityLink(ObjectId.of("E", "F")));
    trade.setCounterparty(new SimpleCounterparty(ExternalId.of("G", "H")));
    trade.setTradeDate(LocalDate.of(2011, 1, 5));
    trade.setTradeTime(OffsetTime.parse("14:30+02:00"));

    // set premium
    trade.setPremium(100.00);
    trade.setPremiumCurrency(Currency.USD);
    trade.setPremiumDate(LocalDate.of(2011, 1, 6));
    trade.setPremiumTime(OffsetTime.parse("15:30+02:00"));
    assertEncodeDecodeCycle(Trade.class, trade);
  }
  public void testFull() {
    SimpleTrade trade = new SimpleTrade();
    trade.setUniqueId(UniqueId.of("A", "B"));
    trade.setQuantity(BigDecimal.valueOf(12.34d));
    trade.setSecurityLink(new SimpleSecurityLink(ExternalId.of("E", "F")));
    trade.setCounterparty(new SimpleCounterparty(ExternalId.of("G", "H")));
    trade.setTradeDate(LocalDate.of(2011, 1, 5));
    trade.setTradeTime(OffsetTime.parse("14:30+02:00"));

    // set premium
    trade.setPremium(100.00);
    trade.setPremiumCurrency(Currency.USD);
    trade.setPremiumDate(LocalDate.of(2011, 1, 6));
    trade.setPremiumTime(OffsetTime.parse("15:30+02:00"));

    // set attributes
    trade.addAttribute("A", "B");
    trade.addAttribute("C", "D");
    assertEncodeDecodeCycle(Trade.class, trade);
  }