Exemplo n.º 1
0
 @Test
 /** Tests the getters. */
 public void getter() {
   assertEquals("CouponIbor: getter", EUR, CPN_IBOR.getCurrency());
   assertEquals("CouponIbor: getter", INDEX_EURIBOR3M, CPN_IBOR.getIndex());
   assertEquals("CouponIbor: getter", FIXING_START_TIME, CPN_IBOR.getFixingPeriodStartTime());
   assertEquals("CouponIbor: getter", FIXING_END_TIME, CPN_IBOR.getFixingPeriodEndTime());
   assertEquals("CouponIbor: getter", FIXING_ACCRUAL_FACTOR, CPN_IBOR.getFixingAccrualFactor());
 }
Exemplo n.º 2
0
 @Test
 public void testWithNotional() {
   final double notional = NOTIONAL + 1000;
   final CouponIbor expected =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           notional,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertEquals(expected, CPN_IBOR.withNotional(notional));
 }
Exemplo n.º 3
0
 @Test
 /** Tests the equal and hash code. */
 public void testEqualHash() {
   assertEquals("CouponIbor: equal-hash", CPN_IBOR, CPN_IBOR);
   final CouponIbor other =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertEquals("CouponIbor: equal-hash", other, CPN_IBOR);
   assertEquals("CouponIbor: equal-hash", other.hashCode(), CPN_IBOR.hashCode());
   CouponIbor modified;
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME + 0.1,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR + 0.1,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL + 1.0,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME - 0.1,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           Currency.USD,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_IBOR_MASTER.getIndex("USDLIBOR3M"),
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME + 0.1,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME + 0.1,
           FIXING_ACCRUAL_FACTOR);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
   modified =
       new CouponIbor(
           EUR,
           PAYMENT_TIME,
           ACCRUAL_FACTOR,
           NOTIONAL,
           FIXING_TIME,
           INDEX_EURIBOR3M,
           FIXING_START_TIME,
           FIXING_END_TIME,
           FIXING_ACCRUAL_FACTOR + 0.1);
   assertFalse("CouponIbor: equal-hash", CPN_IBOR.equals(modified));
 }