TradeRoundTrip implements IRoundTrip { @Override 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(); }  @Override void addTradeReference(TradeOrder order, TradeReferenceLine tradeReference); @Override String getResults(); @Override boolean isComplete(); @Override String getCorrelationId(); TradeOrder getEntryOrder(); TradeOrder getExitOrder(); static final long serialVersionUID; }
@Test public void testGetResults() { ZonedDateTime entryFilledTime = ZonedDateTime.of(2017, 2, 8, 6, 18, 20, 0, ZoneId.systemDefault()); ZonedDateTime exitFilledTime = ZonedDateTime.of(2017, 2, 8, 7, 18, 20, 0, ZoneId.systemDefault()); testRoundTrip.direction = LONG; testRoundTrip.entry = mockEntryOrder; testRoundTrip.exit = mockExitOrder; Ticker ticker = new StockTicker("QQQ"); int size = 200; double entryPrice = 100.23; double exitPrice = 100.51; when(mockEntryOrder.getOrderFilledTime()).thenReturn(entryFilledTime); when(mockEntryOrder.getTicker()).thenReturn(ticker); when(mockEntryOrder.getSize()).thenReturn(size); when(mockEntryOrder.getFilledPrice()).thenReturn(entryPrice); when(mockExitOrder.getOrderFilledTime()).thenReturn(exitFilledTime); when(mockExitOrder.getFilledPrice()).thenReturn(exitPrice); String expectedString = "2017-02-08T06:18:20,LONG,QQQ,200,100.23,0,2017-02-08T07:18:20,100.51,0"; assertEquals(expectedString, testRoundTrip.getResults()); }