//------------------------------------------------------------------------- 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)); }
public virtual void test_forecastValue_unknownType() { SwapPaymentPeriod mockPaymentPeriod = mock(typeof(SwapPaymentPeriod)); DispatchingSwapPaymentPeriodPricer test = DispatchingSwapPaymentPeriodPricer.DEFAULT; assertThrowsIllegalArg(() => test.forecastValue(mockPaymentPeriod, MOCK_PROV)); }
//------------------------------------------------------------------------- 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); }