public virtual void test_of_null()
 {
     assertThrowsIllegalArg(() => IborRateStubCalculation.ofIborRate(null));
     assertThrowsIllegalArg(() => IborRateStubCalculation.ofIborInterpolatedRate(null, GBP_LIBOR_3M));
     assertThrowsIllegalArg(() => IborRateStubCalculation.ofIborInterpolatedRate(GBP_LIBOR_3M, null));
     assertThrowsIllegalArg(() => IborRateStubCalculation.ofIborInterpolatedRate(null, null));
 }
        public virtual void test_ofIborRate()
        {
            IborRateStubCalculation test = IborRateStubCalculation.ofIborRate(GBP_LIBOR_3M);

            assertEquals(test.FixedRate, double?.empty());
            assertEquals(test.Index, GBP_LIBOR_3M);
            assertEquals(test.IndexInterpolated, null);
            assertEquals(test.FixedRate, false);
            assertEquals(test.KnownAmount, false);
            assertEquals(test.FloatingRate, true);
            assertEquals(test.Interpolated, false);
        }
        public virtual void test_serialization()
        {
            IborRateStubCalculation test = IborRateStubCalculation.ofIborRate(GBP_LIBOR_3M);

            assertSerialization(test);
        }
        public virtual void test_expand_firstRateFixedInitialStubSpecified()
        {
            IborRateCalculation test = IborRateCalculation.builder().dayCount(ACT_365F).index(GBP_LIBOR_1M).fixingDateOffset(MINUS_TWO_DAYS).initialStub(IborRateStubCalculation.ofIborRate(GBP_LIBOR_1W)).firstRate(0.024d).build();
            RateAccrualPeriod   rap1 = RateAccrualPeriod.builder(ACCRUAL1STUB).yearFraction(ACCRUAL1STUB.yearFraction(ACT_365F, ACCRUAL_SCHEDULE_INITIAL_STUB)).rateComputation(IborRateComputation.of(GBP_LIBOR_1W, DATE_01_06, REF_DATA)).build();
            RateAccrualPeriod   rap2 = RateAccrualPeriod.builder(ACCRUAL2).yearFraction(ACCRUAL2.yearFraction(ACT_365F, ACCRUAL_SCHEDULE_INITIAL_STUB)).rateComputation(IborRateComputation.of(GBP_LIBOR_1M, DATE_02_03, REF_DATA)).build();
            RateAccrualPeriod   rap3 = RateAccrualPeriod.builder(ACCRUAL3).yearFraction(ACCRUAL3.yearFraction(ACT_365F, ACCRUAL_SCHEDULE_INITIAL_STUB)).rateComputation(IborRateComputation.of(GBP_LIBOR_1M, DATE_03_03, REF_DATA)).build();
            ImmutableList <RateAccrualPeriod> periods = test.createAccrualPeriods(ACCRUAL_SCHEDULE_INITIAL_STUB, ACCRUAL_SCHEDULE_INITIAL_STUB, REF_DATA);

            assertEquals(periods, ImmutableList.of(rap1, rap2, rap3));
        }
        public virtual void test_collectIndices_stubCalcsTwoStubs()
        {
            IborRateCalculation test = IborRateCalculation.builder().dayCount(ACT_365F).index(GBP_LIBOR_1M).fixingDateOffset(MINUS_TWO_DAYS).initialStub(IborRateStubCalculation.ofIborRate(GBP_LIBOR_1W)).finalStub(IborRateStubCalculation.ofIborRate(GBP_LIBOR_3M)).build();

            ImmutableSet.Builder <Index> builder = ImmutableSet.builder();
            test.collectIndices(builder);
            assertEquals(builder.build(), ImmutableSet.of(GBP_LIBOR_1M, GBP_LIBOR_1W, GBP_LIBOR_3M));
        }