### Question:
TradingRecord implements Serializable { public Trade getLastTrade() { if (!trades.isEmpty()) { return trades.get(trades.size() - 1); } return null; } TradingRecord();  TradingRecord(OrderType entryOrderType);  TradingRecord(Order... orders); Trade getCurrentTrade(); final void operate(int index); final void operate(int index, Decimal price, Decimal amount); final boolean enter(int index); final boolean enter(int index, Decimal price, Decimal amount); final boolean exit(int index); final boolean exit(int index, Decimal price, Decimal amount); boolean isClosed(); List<Trade> getTrades(); int getTradeCount(); Trade getLastTrade(); Order getLastOrder(); Order getLastOrder(OrderType orderType); Order getLastEntry(); Order getLastExit();  }### Answer:
@Test public void getLastTrade() { assertNull(emptyRecord.getLastTrade()); assertEquals(new Trade(Order.buyAt(0), Order.sellAt(3)), openedRecord.getLastTrade()); assertEquals(new Trade(Order.buyAt(7), Order.sellAt(8)), closedRecord.getLastTrade()); }