예제 #1
0
        //-------------------------------------------------------------------------
        public virtual void test_forecastValueSensitivity_unknownType()
        {
            SwapPaymentPeriod mockPaymentPeriod     = mock(typeof(SwapPaymentPeriod));
            DispatchingSwapPaymentPeriodPricer test = DispatchingSwapPaymentPeriodPricer.DEFAULT;

            assertThrowsIllegalArg(() => test.forecastValueSensitivity(mockPaymentPeriod, MOCK_PROV));
        }
예제 #2
0
        public virtual void test_presentValue_unknownType()
        {
            SwapPaymentPeriod mockPaymentPeriod     = mock(typeof(SwapPaymentPeriod));
            DispatchingSwapPaymentPeriodPricer test = DispatchingSwapPaymentPeriodPricer.DEFAULT;

            assertThrowsIllegalArg(() => test.presentValue(mockPaymentPeriod, MOCK_PROV));
        }
예제 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_forecastValue_RatePaymentPeriod()
        {
            double expected = 0.0123d;
            SwapPaymentPeriodPricer <RatePaymentPeriod> mockNotionalExchangeFn = mock(typeof(SwapPaymentPeriodPricer));

            when(mockNotionalExchangeFn.forecastValue(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV)).thenReturn(expected);
            DispatchingSwapPaymentPeriodPricer test = new DispatchingSwapPaymentPeriodPricer(mockNotionalExchangeFn, MOCK_KNOWN);

            assertEquals(test.forecastValue(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV), expected, 0d);
        }
예제 #4
0
        //-------------------------------------------------------------------------
        public virtual void test_currencyExposure_RatePaymentPeriod()
        {
            MultiCurrencyAmount expected = MultiCurrencyAmount.of(GBP, 0.0123d);
            SwapPaymentPeriodPricer <RatePaymentPeriod> mockNotionalExchangeFn = mock(typeof(SwapPaymentPeriodPricer));

            when(mockNotionalExchangeFn.currencyExposure(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV)).thenReturn(expected);
            DispatchingSwapPaymentPeriodPricer test = new DispatchingSwapPaymentPeriodPricer(mockNotionalExchangeFn, MOCK_KNOWN);

            assertEquals(test.currencyExposure(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV), expected);
        }
예제 #5
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            DispatchingSwapPaymentPeriodPricer test = new DispatchingSwapPaymentPeriodPricer(MOCK_RATE, MOCK_KNOWN);

            SwapPaymentPeriod kapp = KnownAmountSwapPaymentPeriod.builder().payment(Payment.of(CurrencyAmount.of(GBP, 1000), date(2015, 8, 21))).startDate(date(2015, 5, 19)).endDate(date(2015, 8, 19)).build();
            SwapPaymentPeriod mockPaymentPeriod = mock(typeof(SwapPaymentPeriod));

            ignoreThrows(() => test.presentValue(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.presentValue(kapp, MOCK_PROV));
            ignoreThrows(() => test.presentValue(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.forecastValue(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.forecastValue(kapp, MOCK_PROV));
            ignoreThrows(() => test.forecastValue(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.pvbp(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.pvbp(kapp, MOCK_PROV));
            ignoreThrows(() => test.pvbp(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.presentValueSensitivity(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.presentValueSensitivity(kapp, MOCK_PROV));
            ignoreThrows(() => test.presentValueSensitivity(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.forecastValueSensitivity(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.forecastValueSensitivity(kapp, MOCK_PROV));
            ignoreThrows(() => test.forecastValueSensitivity(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.pvbpSensitivity(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.pvbpSensitivity(kapp, MOCK_PROV));
            ignoreThrows(() => test.pvbpSensitivity(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.accruedInterest(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.accruedInterest(kapp, MOCK_PROV));
            ignoreThrows(() => test.accruedInterest(mockPaymentPeriod, MOCK_PROV));

            ExplainMapBuilder explain = ExplainMap.builder();

            ignoreThrows(() => test.explainPresentValue(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV, explain));
            ignoreThrows(() => test.explainPresentValue(kapp, MOCK_PROV, explain));
            ignoreThrows(() => test.explainPresentValue(mockPaymentPeriod, MOCK_PROV, explain));

            ignoreThrows(() => test.currencyExposure(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.currencyExposure(kapp, MOCK_PROV));
            ignoreThrows(() => test.currencyExposure(mockPaymentPeriod, MOCK_PROV));

            ignoreThrows(() => test.currentCash(SwapDummyData.FIXED_RATE_PAYMENT_PERIOD_REC_GBP, MOCK_PROV));
            ignoreThrows(() => test.currentCash(kapp, MOCK_PROV));
            ignoreThrows(() => test.currentCash(mockPaymentPeriod, MOCK_PROV));
        }