### Question:
DiscountingIborFutureTradePricer { double referencePrice(ResolvedIborFutureTrade trade, LocalDate valuationDate, double lastSettlementPrice) { ArgChecker.notNull(valuationDate, "valuationDate"); return trade.getTradedPrice() .filter(tp -> tp.getTradeDate().equals(valuationDate)) .map(tp -> tp.getPrice()) .orElse(lastSettlementPrice); } DiscountingIborFutureTradePricer(
      DiscountingIborFutureProductPricer productPricer); double price(ResolvedIborFutureTrade trade, RatesProvider ratesProvider); PointSensitivities priceSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider); CurrencyAmount presentValue(ResolvedIborFutureTrade trade, RatesProvider ratesProvider, double lastSettlementPrice); PointSensitivities presentValueSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider); double parSpread(ResolvedIborFutureTrade trade, RatesProvider ratesProvider, double lastSettlementPrice); PointSensitivities parSpreadSensitivity(ResolvedIborFutureTrade trade, RatesProvider ratesProvider); static final DiscountingIborFutureTradePricer DEFAULT; }### Answer:
@Test public void test_reference_price_after_trade_date() { LocalDate tradeDate = FUTURE_TRADE.getTradedPrice().get().getTradeDate(); LocalDate valuationDate = tradeDate.plusDays(1); double settlementPrice = 0.995; double referencePrice = PRICER_TRADE.referencePrice(FUTURE_TRADE, valuationDate, settlementPrice); assertThat(referencePrice).isEqualTo(settlementPrice); }
@Test public void test_reference_price_on_trade_date() { LocalDate tradeDate = FUTURE_TRADE.getTradedPrice().get().getTradeDate(); LocalDate valuationDate = tradeDate; double settlementPrice = 0.995; double referencePrice = PRICER_TRADE.referencePrice(FUTURE_TRADE, valuationDate, settlementPrice); assertThat(referencePrice).isEqualTo(FUTURE_TRADE.getTradedPrice().get().getPrice()); }
@Test public void test_reference_price_val_date_not_null() { double settlementPrice = 0.995; assertThatIllegalArgumentException() .isThrownBy(() -> PRICER_TRADE.referencePrice(FUTURE_TRADE, null, settlementPrice)); }