//-------------------------------------------------------------------------
        public virtual void test_builder_ensureDefaults()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            assertEquals(test.ResetFrequency, P1M);
            assertEquals(test.BusinessDayAdjustment, BusinessDayAdjustment.of(FOLLOWING, GBLO));
            assertEquals(test.ResetMethod, UNWEIGHTED);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            coverImmutableBean(test);
            ResetSchedule test2 = ResetSchedule.builder().resetFrequency(P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBLO)).resetMethod(WEIGHTED).build();

            coverBeanEquals(test, test2);
        }
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            ResetSchedule  test          = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();
            SchedulePeriod accrualPeriod = SchedulePeriod.of(DATE_01_06, DATE_04_07, DATE_01_05, DATE_04_05);
            Schedule       schedule      = test.createSchedule(DAY_5, REF_DATA).apply(accrualPeriod);
            Schedule       expected      = Schedule.builder().periods(SchedulePeriod.of(DATE_01_06, DATE_02_05, DATE_01_05, DATE_02_05), SchedulePeriod.of(DATE_02_05, DATE_03_05, DATE_02_05, DATE_03_05), SchedulePeriod.of(DATE_03_05, DATE_04_07, DATE_03_05, DATE_04_05)).frequency(P1M).rollConvention(DAY_5).build();

            assertEquals(schedule, expected);
        }
        public virtual void test_serialization()
        {
            ResetSchedule test = ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).build();

            assertSerialization(test);
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            IborRateCalculation test = IborRateCalculation.builder().dayCount(ACT_365F).index(GBP_LIBOR_3M).fixingDateOffset(MINUS_TWO_DAYS).build();

            coverImmutableBean(test);
            IborRateCalculation test2 = IborRateCalculation.builder().dayCount(ACT_360).index(GBP_LIBOR_6M).resetPeriods(ResetSchedule.builder().resetFrequency(P3M).resetMethod(IborRateResetMethod.UNWEIGHTED).businessDayAdjustment(BusinessDayAdjustment.NONE).build()).fixingDateOffset(MINUS_THREE_DAYS).fixingRelativeTo(PERIOD_END).negativeRateMethod(NOT_NEGATIVE).firstRegularRate(0.028d).initialStub(IborRateStubCalculation.NONE).finalStub(IborRateStubCalculation.NONE).gearing(ValueSchedule.of(2d)).spread(ValueSchedule.of(-0.025d)).build();

            coverBeanEquals(test, test2);
        }
        public virtual void test_expand_initialStubAndResetPeriods_weighted_firstFixed()
        {
            IborRateCalculation test = IborRateCalculation.builder().dayCount(ACT_360).index(GBP_LIBOR_3M).fixingDateOffset(MINUS_TWO_DAYS).resetPeriods(ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).resetMethod(WEIGHTED).build()).firstRegularRate(0.028d).initialStub(IborRateStubCalculation.ofFixedRate(0.030d)).build();

            SchedulePeriod accrual1 = SchedulePeriod.of(DATE_02_05, DATE_04_07, DATE_02_05, DATE_04_05);
            SchedulePeriod accrual2 = SchedulePeriod.of(DATE_04_07, DATE_07_07, DATE_04_05, DATE_07_05);
            Schedule       schedule = Schedule.builder().periods(accrual1, accrual2).frequency(P3M).rollConvention(DAY_5).build();

            RateAccrualPeriod    rap1 = RateAccrualPeriod.builder(accrual1).yearFraction(accrual1.yearFraction(ACT_360, schedule)).rateComputation(FixedRateComputation.of(0.030d)).build();
            IborIndexObservation obs4 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_04_03, REF_DATA);
            IborIndexObservation obs5 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_05_01, REF_DATA);
            IborIndexObservation obs6 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_06_03, REF_DATA);
            ImmutableList <IborAveragedFixing> fixings2 = ImmutableList.of(IborAveragedFixing.ofDaysInResetPeriod(obs4, DATE_04_07, DATE_05_06, 0.028d), IborAveragedFixing.ofDaysInResetPeriod(obs5, DATE_05_06, DATE_06_05), IborAveragedFixing.ofDaysInResetPeriod(obs6, DATE_06_05, DATE_07_07));
            RateAccrualPeriod rap2 = RateAccrualPeriod.builder(accrual2).yearFraction(accrual2.yearFraction(ACT_360, schedule)).rateComputation(IborAveragedRateComputation.of(fixings2)).build();
            ImmutableList <RateAccrualPeriod> periods = test.createAccrualPeriods(schedule, schedule, REF_DATA);

            assertEquals(periods, ImmutableList.of(rap1, rap2));
        }
        public virtual void test_expand_resetPeriods_weighted_firstFixingDateOffset()
        {
            // only the fixing date of the first reset period is changed, everything else stays the same
            IborRateCalculation test = IborRateCalculation.builder().dayCount(ACT_365F).index(GBP_LIBOR_3M).fixingDateOffset(MINUS_TWO_DAYS).resetPeriods(ResetSchedule.builder().resetFrequency(P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, GBLO)).resetMethod(WEIGHTED).build()).firstFixingDateOffset(MINUS_ONE_DAY).build();

            SchedulePeriod accrual1 = SchedulePeriod.of(DATE_01_06, DATE_04_07, DATE_01_05, DATE_04_05);
            SchedulePeriod accrual2 = SchedulePeriod.of(DATE_04_07, DATE_07_07, DATE_04_05, DATE_07_05);
            Schedule       schedule = Schedule.builder().periods(accrual1, accrual2).frequency(P3M).rollConvention(DAY_5).build();

            IborIndexObservation obs1 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_01_03, REF_DATA);
            IborIndexObservation obs2 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_02_03, REF_DATA);
            IborIndexObservation obs3 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_03_03, REF_DATA);
            ImmutableList <IborAveragedFixing> fixings1 = ImmutableList.of(IborAveragedFixing.ofDaysInResetPeriod(obs1, DATE_01_06, DATE_02_05), IborAveragedFixing.ofDaysInResetPeriod(obs2, DATE_02_05, DATE_03_05), IborAveragedFixing.ofDaysInResetPeriod(obs3, DATE_03_05, DATE_04_07));
            RateAccrualPeriod rap1 = RateAccrualPeriod.builder(accrual1).yearFraction(accrual1.yearFraction(ACT_365F, schedule)).rateComputation(IborAveragedRateComputation.of(fixings1)).build();

            IborIndexObservation obs4 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_04_03, REF_DATA);
            IborIndexObservation obs5 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_05_01, REF_DATA);
            IborIndexObservation obs6 = IborIndexObservation.of(GBP_LIBOR_3M, DATE_06_03, REF_DATA);
            ImmutableList <IborAveragedFixing> fixings2 = ImmutableList.of(IborAveragedFixing.ofDaysInResetPeriod(obs4, DATE_04_07, DATE_05_06), IborAveragedFixing.ofDaysInResetPeriod(obs5, DATE_05_06, DATE_06_05), IborAveragedFixing.ofDaysInResetPeriod(obs6, DATE_06_05, DATE_07_07));
            RateAccrualPeriod rap2 = RateAccrualPeriod.builder(accrual2).yearFraction(accrual2.yearFraction(ACT_365F, schedule)).rateComputation(IborAveragedRateComputation.of(fixings2)).build();
            ImmutableList <RateAccrualPeriod> periods = test.createAccrualPeriods(schedule, schedule, REF_DATA);

            assertEquals(periods, ImmutableList.of(rap1, rap2));
        }