public virtual void test_resolveValues_indexBased_indexTooBig()
        {
            ValueStep     step = ValueStep.of(3, ValueAdjustment.ofReplace(300d));
            ValueSchedule test = ValueSchedule.of(200d, ImmutableList.of(step));

            assertThrowsIllegalArg(() => test.resolveValues(SCHEDULE));
        }
        //-------------------------------------------------------------------------
        public virtual void of()
        {
            CalculationResults test = CalculationResults.of(TARGET, ImmutableList.of(CALC_RESULT));

            assertEquals(test.Target, TARGET);
            assertEquals(test.Cells, ImmutableList.of(CALC_RESULT));
        }
        public virtual void test_build()
        {
            FxOptionSensitivity @base = FxOptionSensitivity.of(NAME, PAIR, EXPIRY, STRIKE, FORWARD, GBP, SENSI_VALUE);
            PointSensitivities  test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
        public virtual void test_of_list()
        {
            FailureItems test = FailureItems.of(ImmutableList.of(FAILURE1, FAILURE2));

            assertEquals(test.Empty, false);
            assertEquals(test.Failures, ImmutableList.of(FAILURE1, FAILURE2));
        }
Ejemplo n.º 5
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            IborRateSensitivity @base = IborRateSensitivity.of(GBP_LIBOR_3M_OBSERVATION, 32d);
            PointSensitivities  test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
Ejemplo n.º 6
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            IborFutureOptionSensitivity @base = IborFutureOptionSensitivity.of(NAME, 12d, date(2015, 8, 28), 0.98, 0.99, GBP, 32d);
            PointSensitivities          test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
        public virtual void test_of_list_size1()
        {
            PointSensitivities test = PointSensitivityBuilder.of(ImmutableList.of(SENS)).build();

            assertEquals(test.size(), 1);
            assertEquals(test.Sensitivities.get(0), SENS);
        }
        public virtual void test_of()
        {
            ValuationZoneTimeDefinition test = ValuationZoneTimeDefinition.of(LocalTime.MIDNIGHT, ZONE_ID, LOCAL_TIME_1, LOCAL_TIME_2, LOCAL_TIME_3);

            assertEquals(test.LocalTimes, ImmutableList.of(LOCAL_TIME_1, LOCAL_TIME_2, LOCAL_TIME_3));
            assertEquals(test.ZoneId, ZONE_ID);
        }
Ejemplo n.º 9
0
        public virtual void test_of_List()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS1, CS2));

            assertEquals(test.Sensitivities, ImmutableList.of(CS1, CS2));
            assertEquals(test.size(), 2);
        }
        public virtual void test_of_intStepsArray()
        {
            ValueSchedule test = ValueSchedule.of(10000d, STEP1, STEP2);

            assertEquals(test.InitialValue, 10000d, TOLERANCE);
            assertEquals(test.Steps, ImmutableList.of(STEP1, STEP2));
        }
        public virtual void test_of_intStepsList_empty()
        {
            ValueSchedule test = ValueSchedule.of(10000d, Lists.newArrayList());

            assertEquals(test.InitialValue, 10000d, TOLERANCE);
            assertEquals(test.Steps, ImmutableList.of());
        }
        public virtual void test_constant_ALWAYS_1()
        {
            ValueSchedule test = ValueSchedule.ALWAYS_1;

            assertEquals(test.InitialValue, 1d, TOLERANCE);
            assertEquals(test.Steps, ImmutableList.of());
        }
        public virtual void test_resolveValues_dateBased_invalidDateAfter()
        {
            ValueStep     step = ValueStep.of(date(2014, 4, 3), ValueAdjustment.ofReplace(300d));
            ValueSchedule test = ValueSchedule.of(200d, ImmutableList.of(step));

            assertThrowsIllegalArg(() => test.resolveValues(SCHEDULE), "ValueStep date is after the end of the schedule.*");
        }
        public virtual void test_resolveValues_dateBased_invalidChangeValue()
        {
            ValueStep     step = ValueStep.of(date(2014, 4, 1), ValueAdjustment.ofReplace(300d));
            ValueSchedule test = ValueSchedule.of(200d, ImmutableList.of(step));

            assertThrowsIllegalArg(() => test.resolveValues(SCHEDULE), "ValueStep date does not match a period boundary.*");
        }
Ejemplo n.º 15
0
        //-------------------------------------------------------------------------
        public virtual void test_mergeToTerm()
        {
            Schedule testNormal = Schedule.builder().periods(ImmutableList.of(P1_STUB, P2_NORMAL, P3_NORMAL)).frequency(P1M).rollConvention(DAY_17).build();

            assertEquals(testNormal.mergeToTerm(), Schedule.ofTerm(P1_3));
            assertEquals(testNormal.mergeToTerm().mergeToTerm(), Schedule.ofTerm(P1_3));
        }
Ejemplo n.º 16
0
        //-------------------------------------------------------------------------
        public virtual void test_combinedWith()
        {
            PointSensitivities test  = PointSensitivities.of(Lists.newArrayList(CS2, CS1));
            PointSensitivities test2 = PointSensitivities.of(Lists.newArrayList(CS3));

            assertEquals(test.combinedWith(test2).Sensitivities, ImmutableList.of(CS2, CS1, CS3));
        }
Ejemplo n.º 17
0
        public virtual void test_merge_badDate()
        {
            Schedule test = Schedule.builder().periods(ImmutableList.of(P2_NORMAL, P3_NORMAL, P4_NORMAL, P5_NORMAL, P6_NORMAL)).frequency(P1M).rollConvention(DAY_17).build();

            assertThrows(() => test.merge(2, JUL_03, AUG_17), typeof(ScheduleException));
            assertThrows(() => test.merge(2, JUL_17, SEP_30), typeof(ScheduleException));
        }
Ejemplo n.º 18
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            SwaptionSensitivity @base = SwaptionSensitivity.of(NAME, EXPIRY, TENOR, STRIKE, FORWARD, GBP, 32d);
            PointSensitivities  test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            BondFutureOptionSensitivity @base = BondFutureOptionSensitivity.of(NAME, OPTION_EXPIRY, FUTURE_EXPIRY, STRIKE_PRICE, FUTURE_PRICE, GBP, SENSITIVITY);
            PointSensitivities          test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
Ejemplo n.º 20
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            InflationRateSensitivity @base = InflationRateSensitivity.of(GB_HICP_OBS, 3.5);
            PointSensitivities       test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
        //-------------------------------------------------------------------------
        public virtual void test_EMPTY()
        {
            FailureItems test = FailureItems.EMPTY;

            assertEquals(test.Empty, true);
            assertEquals(test.Failures, ImmutableList.of());
        }
 public virtual void test_matching()
 {
     assertEquals(FpmlPartySelector.matching("a1").selectParties(MAP), ImmutableList.of("A"));
     assertEquals(FpmlPartySelector.matching("a2").selectParties(MAP), ImmutableList.of("A"));
     assertEquals(FpmlPartySelector.matching("b").selectParties(MAP), ImmutableList.of("B"));
     assertEquals(FpmlPartySelector.matching("c").selectParties(MAP), ImmutableList.of());
 }
        public virtual void test_builder_addAll()
        {
            FailureItems test = FailureItems.builder().addAllFailures(ImmutableList.of(FAILURE1, FAILURE2)).build();

            assertEquals(test.Empty, false);
            assertEquals(test.Failures, ImmutableList.of(FAILURE1, FAILURE2));
        }
Ejemplo n.º 24
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            CreditCurveZeroRateSensitivity @base = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY, GBP, YEAR_FRACTION, 32d);
            PointSensitivities             test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
Ejemplo n.º 25
0
        public virtual void of_list()
        {
            CalculationFunctions test = CalculationFunctions.of(ImmutableList.of(TARGET));

            assertEquals(test.getFunction(new TestTarget()), TARGET);
            assertEquals(test.findFunction(new TestTarget()), TARGET);
        }
Ejemplo n.º 26
0
        public virtual void test_of_size4_bothStubs()
        {
            Schedule test = Schedule.builder().periods(ImmutableList.of(P1_STUB, P2_NORMAL, P3_NORMAL, P4_STUB)).frequency(P1M).rollConvention(DAY_17).build();

            assertEquals(test.size(), 4);
            assertEquals(test.Term, false);
            assertEquals(test.SinglePeriod, false);
            assertEquals(test.Frequency, P1M);
            assertEquals(test.RollConvention, DAY_17);
            assertEquals(test.EndOfMonthConvention, false);
            assertEquals(test.Periods, ImmutableList.of(P1_STUB, P2_NORMAL, P3_NORMAL, P4_STUB));
            assertEquals(test.getPeriod(0), P1_STUB);
            assertEquals(test.getPeriod(1), P2_NORMAL);
            assertEquals(test.getPeriod(2), P3_NORMAL);
            assertEquals(test.getPeriod(3), P4_STUB);
            assertEquals(test.StartDate, P1_STUB.StartDate);
            assertEquals(test.EndDate, P4_STUB.EndDate);
            assertEquals(test.UnadjustedStartDate, P1_STUB.UnadjustedStartDate);
            assertEquals(test.UnadjustedEndDate, P4_STUB.UnadjustedEndDate);
            assertEquals(test.FirstPeriod, P1_STUB);
            assertEquals(test.LastPeriod, P4_STUB);
            assertEquals(test.InitialStub, P1_STUB);
            assertEquals(test.FinalStub, P4_STUB);
            assertEquals(test.RegularPeriods, ImmutableList.of(P2_NORMAL, P3_NORMAL));
            assertThrows(() => test.getPeriod(4), typeof(System.IndexOutOfRangeException));
            assertEquals(test.UnadjustedDates, ImmutableList.of(JUL_04, JUL_17, AUG_17, SEP_17, SEP_30));
        }
Ejemplo n.º 27
0
        //-------------------------------------------------------------------------
        public virtual void test_build()
        {
            ZeroRateSensitivity @base = ZeroRateSensitivity.of(GBP, YEARFRAC, 32d);
            PointSensitivities  test  = @base.build();

            assertEquals(test.Sensitivities, ImmutableList.of(@base));
        }
Ejemplo n.º 28
0
        //-------------------------------------------------------------------------
        public virtual void test_isEndOfMonthConvention_eom()
        {
            // schedule doesn't make sense, but test only requires roll convention of EOM
            Schedule test = Schedule.builder().periods(ImmutableList.of(P2_NORMAL, P3_NORMAL)).frequency(P1M).rollConvention(RollConventions.EOM).build();

            assertEquals(test.EndOfMonthConvention, true);
        }
        public virtual void of_list()
        {
            CalculationParameters test = CalculationParameters.of(ImmutableList.of(PARAM));

            assertEquals(test.Parameters.size(), 1);
            assertEquals(test.findParameter(typeof(TestParameter)), PARAM);
        }
        public virtual void test_resolveValues_dateBased_indexZeroValid()
        {
            ValueStep     step = ValueStep.of(date(2014, 1, 1), ValueAdjustment.ofReplace(300d));
            ValueSchedule test = ValueSchedule.of(200d, ImmutableList.of(step));

            assertEquals(test.resolveValues(SCHEDULE), DoubleArray.of(300d, 300d, 300d));
        }