Exemplo n.º 1
0
        public virtual void test_of()
        {
            FixedCouponBondPaymentPeriod test = FixedCouponBondPaymentPeriod.builder().currency(USD).startDate(START_ADJUSTED).unadjustedStartDate(START).endDate(END_ADJUSTED).unadjustedEndDate(END).detachmentDate(DETACHMENT_DATE).notional(NOTIONAL).fixedRate(FIXED_RATE).yearFraction(YEAR_FRACTION).build();

            assertEquals(test.Currency, USD);
            assertEquals(test.UnadjustedStartDate, START);
            assertEquals(test.StartDate, START_ADJUSTED);
            assertEquals(test.UnadjustedEndDate, END);
            assertEquals(test.EndDate, END_ADJUSTED);
            assertEquals(test.PaymentDate, END_ADJUSTED);
            assertEquals(test.DetachmentDate, DETACHMENT_DATE);
            assertEquals(test.FixedRate, FIXED_RATE);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.YearFraction, YEAR_FRACTION);
            assertEquals(test.hasExCouponPeriod(), true);

            // the object is not changed
            assertEquals(test.adjustPaymentDate(TemporalAdjusters.ofDateAdjuster(d => d.plusDays(2))), test);
            ImmutableSet.Builder <Index> builder = ImmutableSet.builder();
            test.collectIndices(builder);
            assertEquals(test.Currency, USD);
            assertEquals(test.UnadjustedStartDate, START);
            assertEquals(test.StartDate, START_ADJUSTED);
            assertEquals(test.UnadjustedEndDate, END);
            assertEquals(test.EndDate, END_ADJUSTED);
            assertEquals(test.PaymentDate, END_ADJUSTED);
            assertEquals(test.DetachmentDate, DETACHMENT_DATE);
            assertEquals(test.FixedRate, FIXED_RATE);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.YearFraction, YEAR_FRACTION);
            assertEquals(test.hasExCouponPeriod(), true);
        }
Exemplo n.º 2
0
        public virtual void test_of_noExCoupon()
        {
            FixedCouponBondPaymentPeriod test = FixedCouponBondPaymentPeriod.builder().currency(USD).startDate(START_ADJUSTED).unadjustedStartDate(START).endDate(END_ADJUSTED).unadjustedEndDate(END).detachmentDate(END_ADJUSTED).notional(NOTIONAL).fixedRate(FIXED_RATE).yearFraction(YEAR_FRACTION).build();

            assertEquals(test.hasExCouponPeriod(), false);
        }