//------------------------------------------------------------------------- public virtual void coverage() { FixedRateStubCalculation test = FixedRateStubCalculation.ofFixedRate(0.025d); coverImmutableBean(test); FixedRateStubCalculation test2 = FixedRateStubCalculation.ofKnownAmount(GBP_P1000); coverBeanEquals(test, test2); }
public virtual void test_ofKnownAmount() { FixedRateStubCalculation test = FixedRateStubCalculation.ofKnownAmount(GBP_P1000); assertEquals(test.FixedRate, double?.empty()); assertEquals(test.KnownAmount, GBP_P1000); assertEquals(test.FixedRate, false); assertEquals(test.KnownAmount, true); }
public virtual void test_createRateComputation_knownAmount() { FixedRateStubCalculation test = FixedRateStubCalculation.ofKnownAmount(GBP_P1000); assertEquals(test.createRateComputation(3d), KnownAmountRateComputation.of(GBP_P1000)); }
public virtual void test_resolve_knownAmountStub() { // test case CurrencyAmount knownAmount = CurrencyAmount.of(GBP, 150d); RateCalculationSwapLeg test = RateCalculationSwapLeg.builder().payReceive(PAY).accrualSchedule(PeriodicSchedule.builder().startDate(DATE_02_03).endDate(DATE_04_03).firstRegularStartDate(DATE_02_05).lastRegularEndDate(DATE_03_05).frequency(P1M).stubConvention(StubConvention.BOTH).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(P1M).paymentDateOffset(PLUS_TWO_DAYS).build()).notionalSchedule(NotionalSchedule.of(GBP, 1000d)).calculation(FixedRateCalculation.builder().dayCount(ACT_365F).rate(ValueSchedule.of(0.025d)).initialStub(FixedRateStubCalculation.ofKnownAmount(knownAmount)).finalStub(FixedRateStubCalculation.ofFixedRate(0.1d)).build()).build(); // expected KnownAmountNotionalSwapPaymentPeriod pp1 = KnownAmountNotionalSwapPaymentPeriod.builder().payment(Payment.of(knownAmount, DATE_02_07)).startDate(DATE_02_03).endDate(DATE_02_05).unadjustedStartDate(DATE_02_03).notionalAmount(CurrencyAmount.of(GBP, -1000d)).build(); RatePaymentPeriod rpp2 = RatePaymentPeriod.builder().paymentDate(DATE_03_07).accrualPeriods(RateAccrualPeriod.builder().startDate(DATE_02_05).endDate(DATE_03_05).yearFraction(ACT_365F.yearFraction(DATE_02_05, DATE_03_05)).rateComputation(FixedRateComputation.of(0.025d)).build()).dayCount(ACT_365F).currency(GBP).notional(-1000d).build(); RatePaymentPeriod rpp3 = RatePaymentPeriod.builder().paymentDate(DATE_04_07).accrualPeriods(RateAccrualPeriod.builder().startDate(DATE_03_05).endDate(DATE_04_03).unadjustedEndDate(DATE_04_03).yearFraction(ACT_365F.yearFraction(DATE_03_05, DATE_04_03)).rateComputation(FixedRateComputation.of(0.1d)).build()).dayCount(ACT_365F).currency(GBP).notional(-1000d).build(); // assertion assertEquals(test.resolve(REF_DATA), ResolvedSwapLeg.builder().type(FIXED).payReceive(PAY).paymentPeriods(pp1, rpp2, rpp3).build()); }