@Test(dataProvider = "name") public void test_extendedEnum(IborIborSwapConvention convention, String name) { IborIborSwapConvention.of(name); // ensures map is populated ImmutableMap<String, IborIborSwapConvention> map = IborIborSwapConvention.extendedEnum().lookupAll(); assertEquals(map.get(name), convention); }
// ------------------------------------------------------------------------- public void test_toTrade_tenor() { IborIborSwapConvention base = ImmutableIborIborSwapConvention.of(NAME, IBOR3M, IBOR6M); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 5, 7); LocalDate endDate = date(2025, 5, 7); SwapTrade test = base.toTrade(tradeDate, TENOR_10Y, BUY, NOTIONAL_2M, 0.25d); Swap expected = Swap.of( IBOR3M.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR6M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M)); assertEquals(test.getTradeInfo().getTradeDate(), Optional.of(tradeDate)); assertEquals(test.getProduct(), expected); }
public void test_of_lookup_null() { assertThrowsIllegalArg(() -> IborIborSwapConvention.of((String) null)); }
public void test_of_lookup_notFound() { assertThrowsIllegalArg(() -> IborIborSwapConvention.of("Rubbish")); }
@Test(dataProvider = "name") public void test_of_lookup(IborIborSwapConvention convention, String name) { assertEquals(IborIborSwapConvention.of(name), convention); }
@Test(dataProvider = "name") public void test_toString(IborIborSwapConvention convention, String name) { assertEquals(convention.toString(), name); }