public virtual void test_of() { TermDepositTemplate test = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION); assertEquals(test.Convention, CONVENTION); assertEquals(test.DepositPeriod, DEPOSIT_PERIOD); }
public virtual void test_builder() { TermDepositTemplate test = TermDepositTemplate.builder().convention(CONVENTION).depositPeriod(DEPOSIT_PERIOD).build(); assertEquals(test.Convention, CONVENTION); assertEquals(test.DepositPeriod, DEPOSIT_PERIOD); }
//------------------------------------------------------------------------- public virtual void coverage() { TermDepositTemplate test1 = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION); coverImmutableBean(test1); TermDepositTemplate test2 = TermDepositTemplate.of(Period.ofMonths(6), ImmutableTermDepositConvention.of("GBP-Dep", GBP, BDA_MOD_FOLLOW, ACT_365F, DaysAdjustment.ofBusinessDays(2, GBLO))); coverBeanEquals(test1, test2); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { TermDepositTemplate other = (TermDepositTemplate)obj; return(JodaBeanUtils.equal(depositPeriod, other.depositPeriod) && JodaBeanUtils.equal(convention, other.convention)); } return(false); }
public virtual void test_createTrade() { TermDepositTemplate template = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION); LocalDate tradeDate = LocalDate.of(2015, 1, 23); BuySell buy = BuySell.BUY; double notional = 2_000_000d; double rate = 0.0125; TermDepositTrade trade = template.createTrade(tradeDate, buy, notional, rate, REF_DATA); TradeInfo tradeInfoExpected = TradeInfo.of(tradeDate); LocalDate startDateExpected = PLUS_TWO_DAYS.adjust(tradeDate, REF_DATA); LocalDate endDateExpected = startDateExpected.plus(DEPOSIT_PERIOD); TermDeposit productExpected = TermDeposit.builder().buySell(buy).currency(EUR).notional(notional).businessDayAdjustment(BDA_MOD_FOLLOW).startDate(startDateExpected).endDate(endDateExpected).rate(rate).dayCount(ACT_360).build(); assertEquals(trade.Info, tradeInfoExpected); assertEquals(trade.Product, productExpected); }
public virtual void test_builder_negativePeriod() { assertThrowsIllegalArg(() => TermDepositTemplate.builder().convention(CONVENTION).depositPeriod(Period.ofMonths(-2)).build()); }
public virtual void test_serialization() { TermDepositTemplate test = TermDepositTemplate.of(DEPOSIT_PERIOD, CONVENTION); assertSerialization(test); }
//------------------------------------------------------------------------- /// <summary> /// Obtains a template based on the specified period and convention. /// </summary> /// <param name="depositPeriod"> the period between the start date and the end date </param> /// <param name="convention"> the market convention </param> /// <returns> the template </returns> public static TermDepositTemplate of(Period depositPeriod, TermDepositConvention convention) { ArgChecker.notNull(depositPeriod, "depositPeriod"); ArgChecker.notNull(convention, "convention"); return(TermDepositTemplate.builder().depositPeriod(depositPeriod).convention(convention).build()); }