//------------------------------------------------------------------------- public virtual void coverage() { SwapLegAmount la1 = SwapLegAmount.builder().amount(CURRENCY_AMOUNT).payReceive(PayReceive.PAY).type(SwapLegType.FIXED).currency(Currency.EUR).build(); coverImmutableBean(la1); SwapLegAmount la2 = SwapLegAmount.builder().amount(CurrencyAmount.of(Currency.GBP, 10000)).payReceive(PayReceive.RECEIVE).type(SwapLegType.IBOR).currency(Currency.GBP).build(); coverBeanEquals(la1, la2); }
//------------------------------------------------------------------------- public virtual void convertedTo() { SwapLegAmount legAmount = SwapLegAmount.builder().amount(CurrencyAmount.of(Currency.GBP, 10)).payReceive(PayReceive.PAY).type(SwapLegType.FIXED).currency(Currency.GBP).build(); SwapLegAmount convertedAmount = legAmount.convertedTo(Currency.USD, FxRate.of(Currency.GBP, Currency.USD, 1.6)); assertThat(convertedAmount.Amount.Currency).isEqualTo(Currency.USD); assertThat(convertedAmount.Amount.Amount).isEqualTo(16.0); assertThat(convertedAmount.PayReceive).isEqualTo(legAmount.PayReceive); assertThat(convertedAmount.Type).isEqualTo(legAmount.Type); assertThat(convertedAmount.Currency).isEqualTo(legAmount.Currency); }
//------------------------------------------------------------------------- public virtual void coverage() { LegAmounts test1 = LegAmounts.of(LEG_AMOUNT_1, LEG_AMOUNT_2); coverImmutableBean(test1); LegAmount swapLeg = SwapLegAmount.builder().amount(CurrencyAmount.of(Currency.GBP, 1557.445)).payReceive(PayReceive.PAY).type(SwapLegType.FIXED).currency(Currency.EUR).build(); LegAmounts test2 = LegAmounts.of(swapLeg); coverBeanEquals(test1, test2); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { SwapLegAmount other = (SwapLegAmount)obj; return(JodaBeanUtils.equal(amount, other.amount) && JodaBeanUtils.equal(payReceive, other.payReceive) && JodaBeanUtils.equal(type, other.type) && JodaBeanUtils.equal(currency, other.currency)); } return(false); }
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); }
public virtual void test_serialization() { SwapLegAmount la = SwapLegAmount.builder().amount(CURRENCY_AMOUNT).payReceive(PayReceive.PAY).type(SwapLegType.FIXED).currency(Currency.EUR).build(); assertSerialization(la); }