public void test_toTrade_dates() {
ImmutableFxSwapConvention base = ImmutableFxSwapConvention.of(EUR_USD, PLUS_TWO_DAYS, BDA_FOLLOW);
LocalDate tradeDate = LocalDate.of(2015, 5, 5);
LocalDate nearDate = LocalDate.of(2015, 7, 5);
LocalDate nearDateAdj = LocalDate.of(2015, 7, 6);
LocalDate farDate = LocalDate.of(2015, 9, 5);
LocalDate farDateAdj = LocalDate.of(2015, 9, 7);
FxSwapTrade test = base.toTrade(tradeDate, nearDate, farDate, BUY, NOTIONAL_EUR, FX_RATE_NEAR, FX_RATE_PTS);
FxSwap expected = FxSwap.ofForwardPoints(
CurrencyAmount.of(EUR, NOTIONAL_EUR), FxRate.of(EUR, USD, FX_RATE_NEAR), FX_RATE_PTS, nearDate, farDate, BDA_FOLLOW);
assertEquals(test.getInfo().getTradeDate(), Optional.of(tradeDate));
assertEquals(test.getProduct(), expected);
ResolvedFxSwap resolvedExpected = ResolvedFxSwap.ofForwardPoints(
CurrencyAmount.of(EUR, NOTIONAL_EUR), USD, FX_RATE_NEAR, FX_RATE_PTS, nearDateAdj, farDateAdj);
assertEquals(test.getProduct().resolve(REF_DATA), resolvedExpected);
}