//------------------------------------------------------------------------- public virtual void coverage() { CashFlow test1 = CashFlow.ofForecastValue(PAYMENT_DATE, USD, FORECAST_VALUE, DISCOUNT_FACTOR); coverImmutableBean(test1); CashFlow test2 = CashFlow.ofForecastValue(LocalDate.of(2015, 7, 11), GBP, 0.24, 0.987); coverBeanEquals(test1, test2); }
public virtual void test_ofForecastValue_Currency() { CashFlow test = CashFlow.ofForecastValue(PAYMENT_DATE, GBP, FORECAST_VALUE, DISCOUNT_FACTOR); assertThat(test.PaymentDate).isEqualTo(PAYMENT_DATE); assertThat(test.PresentValue).hasCurrency(GBP); assertThat(test.PresentValue).hasAmount(PRESENT_VALUE, TOLERANCE); assertThat(test.ForecastValue).hasCurrency(GBP); assertThat(test.ForecastValue).hasAmount(FORECAST_VALUE, TOLERANCE); assertThat(test.DiscountFactor).isCloseTo(DISCOUNT_FACTOR, TOLERANCE); }
//------------------------------------------------------------------------- public virtual void test_convertedTo() { CashFlow @base = CashFlow.ofForecastValue(PAYMENT_DATE, GBP, FORECAST_VALUE, DISCOUNT_FACTOR); CashFlow test = @base.convertedTo(USD, FxRate.of(GBP, USD, 1.5)); assertThat(test.PaymentDate).isEqualTo(PAYMENT_DATE); assertThat(test.PresentValue).hasCurrency(USD); assertThat(test.PresentValue).hasAmount(PRESENT_VALUE * 1.5, TOLERANCE); assertThat(test.ForecastValue).hasCurrency(USD); assertThat(test.ForecastValue).hasAmount(FORECAST_VALUE * 1.5, TOLERANCE); assertThat(test.DiscountFactor).isCloseTo(DISCOUNT_FACTOR, TOLERANCE); }
public virtual void test_convertedTo_noConversion() { CashFlow @base = CashFlow.ofForecastValue(PAYMENT_DATE, GBP, FORECAST_VALUE, DISCOUNT_FACTOR); CashFlow test = @base.convertedTo(GBP, FxMatrix.empty()); assertThat(test.PaymentDate).isEqualTo(PAYMENT_DATE); assertThat(test.PresentValue).hasCurrency(GBP); assertThat(test.PresentValue).hasAmount(PRESENT_VALUE, TOLERANCE); assertThat(test.ForecastValue).hasCurrency(GBP); assertThat(test.ForecastValue).hasAmount(FORECAST_VALUE, TOLERANCE); assertThat(test.DiscountFactor).isCloseTo(DISCOUNT_FACTOR, TOLERANCE); }
public virtual void test_serialization() { CashFlow test = CashFlow.ofForecastValue(PAYMENT_DATE, USD, FORECAST_VALUE, DISCOUNT_FACTOR); assertSerialization(test); }