//------------------------------------------------------------------------- public virtual void test_forecastValueSensitivity_unknownType() { SwapPaymentPeriod mockPaymentPeriod = mock(typeof(SwapPaymentPeriod)); DispatchingSwapPaymentPeriodPricer test = DispatchingSwapPaymentPeriodPricer.DEFAULT; assertThrowsIllegalArg(() => test.forecastValueSensitivity(mockPaymentPeriod, MOCK_PROV)); }
public virtual void test_presentValue_unknownType() { SwapPaymentPeriod mockPaymentPeriod = mock(typeof(SwapPaymentPeriod)); DispatchingSwapPaymentPeriodPricer test = DispatchingSwapPaymentPeriodPricer.DEFAULT; assertThrowsIllegalArg(() => test.presentValue(mockPaymentPeriod, MOCK_PROV)); }
//------------------------------------------------------------------------- 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_of() { SwapPaymentPeriod pp = mock(typeof(SwapPaymentPeriod)); when(pp.Currency).thenReturn(Currency.GBP); ResolvedSwapLeg leg = ResolvedSwapLeg.builder().type(SwapLegType.FIXED).payReceive(PayReceive.PAY).paymentPeriods(pp).build(); SwapLegAmount legAmount = SwapLegAmount.of(leg, CurrencyAmount.of(Currency.GBP, 10)); SwapLegAmount test = legAmount.convertedTo(Currency.USD, FxRate.of(Currency.GBP, Currency.USD, 1.6)); assertThat(test.Amount.Currency).isEqualTo(Currency.USD); assertThat(test.Amount.Amount).isEqualTo(16.0); assertThat(test.PayReceive).isEqualTo(legAmount.PayReceive); assertThat(test.Type).isEqualTo(legAmount.Type); assertThat(test.Currency).isEqualTo(legAmount.Currency); }