RoundTrip implements Serializable { public String getResults() { StringBuilder sb = new StringBuilder(); sb.append(entry.getOrderFilledTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)).append(",") .append(direction).append(",") .append(entry.getTicker().getSymbol()).append(",") .append(entry.getSize()).append(",") .append(entry.getFilledPrice()).append(",") .append(0).append(",") .append(exit.getOrderFilledTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)).append(",") .append(exit.getFilledPrice()).append(",") .append(0); return sb.toString(); }  void addTradeReference( TradeOrder order, TradeReferenceLine tradeReference ); String getResults(); boolean isComplete(); String getCorrelationId(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final long serialVersionUID; }
@Test public void testGetResults() { String expected = "2016-03-03T05:30:45,LONG,QQQ,100,50.43,0,2016-03-04T12:45:00,51.46,0"; ZonedDateTime entryDate = ZonedDateTime.of(2016, 3, 3, 5, 30, 45, 0, ZoneId.systemDefault()); ZonedDateTime exitDate =ZonedDateTime.of(2016, 3, 4, 12, 45, 00, 0, ZoneId.systemDefault()); TradeOrder longEntryOrder = new TradeOrder("123", ticker, 100,TradeDirection.BUY); longEntryOrder.setFilledPrice(50.43); longEntryOrder.setOrderFilledTime(entryDate); TradeOrder longExitOrder = new TradeOrder("234", ticker, 100, TradeDirection.SELL); longExitOrder.setFilledPrice(51.46); longExitOrder.setOrderFilledTime(exitDate); TradeReferenceLine entry = new TradeReferenceLine(); entry.correlationId ="123"; entry.direction = TradeReferenceLine.Direction.LONG; entry.side = ENTRY; TradeReferenceLine exit = new TradeReferenceLine(); exit.correlationId = "234"; exit.direction = LONG; exit.side = EXIT; roundTrip.addTradeReference(longEntryOrder, entry); roundTrip.addTradeReference(longExitOrder, exit); assertEquals(expected, roundTrip.getResults()); }