### Question:
TradingRecord implements Serializable { public Order getLastOrder() { if (!orders.isEmpty()) { return orders.get(orders.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 getLastOrder() { assertNull(emptyRecord.getLastOrder()); assertEquals(Order.buyAt(7), openedRecord.getLastOrder()); assertEquals(Order.sellAt(8), closedRecord.getLastOrder()); assertNull(emptyRecord.getLastOrder(Order.OrderType.BUY)); assertEquals(Order.buyAt(7), openedRecord.getLastOrder(Order.OrderType.BUY)); assertEquals(Order.buyAt(7), closedRecord.getLastOrder(Order.OrderType.BUY)); assertNull(emptyRecord.getLastOrder(Order.OrderType.SELL)); assertEquals(Order.sellAt(3), openedRecord.getLastOrder(Order.OrderType.SELL)); assertEquals(Order.sellAt(8), closedRecord.getLastOrder(Order.OrderType.SELL)); }