//------------------------------------------------------------------------- public virtual void coverage() { TermDeposit test1 = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build(); coverImmutableBean(test1); TermDeposit test2 = TermDeposit.builder().buySell(BuySell.BUY).startDate(LocalDate.of(2015, 1, 21)).endDate(LocalDate.of(2015, 7, 21)).dayCount(ACT_360).notional(NOTIONAL).currency(EUR).rate(RATE).build(); coverBeanEquals(test1, test2); }
//------------------------------------------------------------------------- public virtual void test_resolve() { TermDeposit @base = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build(); ResolvedTermDeposit test = @base.resolve(REF_DATA); LocalDate expectedEndDate = BDA_MOD_FOLLOW.adjust(END_DATE, REF_DATA); double expectedYearFraction = ACT_365F.yearFraction(START_DATE, expectedEndDate); assertEquals(test.StartDate, START_DATE); assertEquals(test.EndDate, expectedEndDate); assertEquals(test.Notional, -NOTIONAL); assertEquals(test.YearFraction, expectedYearFraction, EPS); assertEquals(test.Interest, -RATE * expectedYearFraction * NOTIONAL, NOTIONAL * EPS); assertEquals(test.Rate, RATE); assertEquals(test.Currency, GBP); }
//------------------------------------------------------------------------- public virtual void test_builder() { TermDeposit test = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build(); assertEquals(test.BuySell, SELL); assertEquals(test.StartDate, START_DATE); assertEquals(test.EndDate, END_DATE); assertEquals(test.BusinessDayAdjustment.get(), BDA_MOD_FOLLOW); assertEquals(test.DayCount, ACT_365F); assertEquals(test.Notional, NOTIONAL); assertEquals(test.Rate, RATE); assertEquals(test.Currency, GBP); assertEquals(test.CrossCurrency, false); assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP)); assertEquals(test.allCurrencies(), ImmutableSet.of(GBP)); }
public virtual void test_builder_wrongDates() { assertThrowsIllegalArg(() => TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(LocalDate.of(2014, 10, 19)).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(EUR).rate(RATE).build()); }
public virtual void test_serialization() { TermDeposit test = TermDeposit.builder().buySell(SELL).startDate(START_DATE).endDate(END_DATE).businessDayAdjustment(BDA_MOD_FOLLOW).dayCount(ACT_365F).notional(NOTIONAL).currency(GBP).rate(RATE).build(); assertSerialization(test); }