StopOrder extends Order implements Comparable<StopOrder> { @Override public int compareTo(StopOrder stopOrder) { if (this.getType() != stopOrder.getType()) { return this.getType() == OrderType.BID ? -1 : 1; } if (this.getStopPrice().compareTo(stopOrder.getStopPrice()) != 0) { return this.getType() == OrderType.BID ? -1 : 1; } return ObjectUtils.compare(this.getIntention(), stopOrder.getIntention()); } StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice);  StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      BigDecimal cumulativeAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice);  StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice,
      BigDecimal averagePrice,
      BigDecimal cumulativeAmount,
      OrderStatus status);  StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice,
      BigDecimal limitPrice,
      BigDecimal averagePrice,
      BigDecimal cumulativeAmount,
      OrderStatus status);  StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice,
      BigDecimal limitPrice,
      BigDecimal averagePrice,
      BigDecimal cumulativeAmount,
      BigDecimal fee,
      OrderStatus status);  StopOrder(
      OrderType type,
      BigDecimal originalAmount,
      Instrument instrument,
      String id,
      Date timestamp,
      BigDecimal stopPrice,
      BigDecimal limitPrice,
      BigDecimal averagePrice,
      BigDecimal cumulativeAmount,
      BigDecimal fee,
      OrderStatus status,
      String userReference,
      Intention intention); BigDecimal getStopPrice(); BigDecimal getLimitPrice(); Intention getIntention(); @Override String toString(); @Override int compareTo(StopOrder stopOrder); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testSerializeDeserialize() throws IOException { final Order.OrderType type = Order.OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal limitPrice = new BigDecimal("250.34"); final BigDecimal averagePrice = new BigDecimal("255.00"); final BigDecimal cumulativeAmount = new BigDecimal("0.00"); final BigDecimal stopPrice = new BigDecimal("266.21"); final BigDecimal fee = new BigDecimal("22.2"); final Date timestamp = new Date(); final String id = "id"; final Order.OrderStatus status = Order.OrderStatus.FILLED; final String reference = "reference"; final StopOrder.Intention intention = StopOrder.Intention.TAKE_PROFIT; final StopOrder original = new StopOrder( type, originalAmount, currencyPair, id, timestamp, stopPrice, limitPrice, averagePrice, cumulativeAmount, fee, status, reference, intention); original.addOrderFlag(TestFlags.TEST1); original.addOrderFlag(TestFlags.TEST3); StopOrder jsonCopy = ObjectMapperHelper.viaJSON(original); assertThat(jsonCopy).isEqualToIgnoringGivenFields(original, "cumulativeAmount"); assertTrue(jsonCopy.getCumulativeAmount().compareTo(original.getCumulativeAmount()) == 0); }