//-------------------------------------------------------------------------
        public virtual void test_toImmutable()
        {
            MutablePointSensitivities test = new MutablePointSensitivities();

            test.addAll(Lists.newArrayList(CS3, CS2, CS1));
            assertEquals(test.toImmutable(), PointSensitivities.of(ImmutableList.of(CS3, CS2, CS1)));
        }
Exemple #2
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);
        }
Exemple #3
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));
        }
Exemple #4
0
        public virtual void test_equalWithTolerance_value()
        {
            PointSensitivities test1 = PointSensitivities.of(Lists.newArrayList(CS3, CS1)).normalized();
            PointSensitivities test2 = PointSensitivities.of(Lists.newArrayList(CS3B, CS1)).normalized();

            assertFalse(test1.equalWithTolerance(test2, 1.0E+1));
        }
Exemple #5
0
        public virtual void test_equalWithTolerance_true()
        {
            PointSensitivity   cs1b  = DummyPointSensitivity.of(GBP, date(2015, 6, 30), 12.1d);
            PointSensitivities test1 = PointSensitivities.of(Lists.newArrayList(CS3, CS1)).normalized();
            PointSensitivities test2 = PointSensitivities.of(Lists.newArrayList(CS3, cs1b)).normalized();

            assertTrue(test1.equalWithTolerance(test2, 1.0E-1));
        }
Exemple #6
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            coverImmutableBean(test);
            PointSensitivities test2 = PointSensitivities.of(Lists.newArrayList(CS1));

            coverBeanEquals(test, test2);
        }
Exemple #7
0
        //-------------------------------------------------------------------------
        public virtual void test_convertedTo_singleCurrency()
        {
            double             rate     = 1.5d;
            FxMatrix           matrix   = FxMatrix.of(CurrencyPair.of(GBP, USD), rate);
            PointSensitivities @base    = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));
            PointSensitivities test1    = @base.convertedTo(USD, matrix);
            PointSensitivity   c1Conv   = CS1.convertedTo(USD, matrix);
            PointSensitivity   c2Conv   = CS2.convertedTo(USD, matrix);
            PointSensitivity   c3Conv   = CS3.convertedTo(USD, matrix);
            PointSensitivities expected = PointSensitivities.of(Lists.newArrayList(c3Conv, c2Conv, c1Conv));

            assertEquals(test1.normalized(), expected.normalized());
            PointSensitivities test2 = @base.convertedTo(GBP, matrix);

            assertEquals(test2.normalized(), @base.normalized());
        }
Exemple #8
0
        public virtual void test_convertedTo_multipleCurrency()
        {
            double             rate      = 1.5d;
            FxMatrix           matrix    = FxMatrix.of(CurrencyPair.of(GBP, USD), rate);
            PointSensitivities @base     = PointSensitivities.of(Lists.newArrayList(CS4, CS3, CS1));
            PointSensitivities test1     = @base.convertedTo(USD, matrix);
            PointSensitivity   c1Conv    = CS1.convertedTo(USD, matrix);
            PointSensitivity   c3Conv    = CS3.convertedTo(USD, matrix);
            PointSensitivity   c3c4Usd   = c3Conv.withSensitivity(c3Conv.Sensitivity + CS4.Sensitivity);
            PointSensitivities expected1 = PointSensitivities.of(Lists.newArrayList(c3c4Usd, c1Conv));

            assertEquals(test1.normalized(), expected1.normalized());
            PointSensitivities test2     = @base.convertedTo(GBP, matrix);
            PointSensitivity   c4Conv    = CS4.convertedTo(GBP, matrix);
            PointSensitivity   c3c4GBP   = CS3.withSensitivity(CS3.Sensitivity + c4Conv.Sensitivity);
            PointSensitivities expected2 = PointSensitivities.of(Lists.newArrayList(c3c4GBP, CS1));

            assertEquals(test2.normalized(), expected2.normalized());
        }
Exemple #9
0
        public virtual void test_normalized_merges()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1, CS3B));

            assertEquals(test.normalized().Sensitivities, ImmutableList.of(CS1, CS2, CS3.withSensitivity(35d)));
        }
Exemple #10
0
        //-------------------------------------------------------------------------
        public virtual void test_normalized_sorts()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            assertEquals(test.normalized().Sensitivities, ImmutableList.of(CS1, CS2, CS3));
        }
Exemple #11
0
        public virtual void test_mapSensitivities()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            assertEquals(test.mapSensitivities(s => s / 2).Sensitivities, ImmutableList.of(CS3.withSensitivity(16d), CS2.withSensitivity(11d), CS1.withSensitivity(6d)));
        }
Exemple #12
0
        //-------------------------------------------------------------------------
        public virtual void test_multipliedBy()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            assertEquals(test.multipliedBy(2d).Sensitivities, ImmutableList.of(CS3.withSensitivity(64d), CS2.withSensitivity(44d), CS1.withSensitivity(24d)));
        }
Exemple #13
0
        public virtual void test_serialization()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            assertSerialization(test);
        }
Exemple #14
0
        //-------------------------------------------------------------------------
        public virtual void test_toMutable()
        {
            PointSensitivities test = PointSensitivities.of(Lists.newArrayList(CS3, CS2, CS1));

            assertEquals(test.toMutable().Sensitivities, ImmutableList.of(CS3, CS2, CS1));
        }