@Test
 /** Tests the builders. */
 public void from() {
   final DepositZeroDefinition from =
       DepositZeroDefinition.from(EUR, SPOT_DATE, END_DATE, DAY_COUNT, RATE, CALENDAR);
   final DepositZeroDefinition comp =
       new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, 1.0, DEPOSIT_AF, RATE);
   assertEquals("DepositZeroDefinition - From", comp, from);
 }
 @Test
 /** Tests toDerivative. */
 public void toDerivativeMaturity() {
   final ZonedDateTime referenceDate = END_DATE;
   final DepositZero converted = DEPOSIT_DEFINITION.toDerivative(referenceDate);
   final double startTime = 0;
   final double endTime = TimeCalculator.getTimeBetween(referenceDate, END_DATE);
   final DepositZero expected =
       new DepositZero(
           EUR,
           startTime,
           endTime,
           0.0,
           NOTIONAL,
           DEPOSIT_AF,
           RATE,
           DEPOSIT_DEFINITION.getInterestAmount());
   assertEquals("DepositZeroDefinition: toDerivative", expected, converted);
 }
 @Test
 /** Tests toDerivative. */
 public void toDerivativeBetweenTradeAndSettle() {
   final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 13);
   final DepositZero converted = DEPOSIT_DEFINITION.toDerivative(referenceDate);
   final double startTime = TimeCalculator.getTimeBetween(referenceDate, SPOT_DATE);
   final double endTime = TimeCalculator.getTimeBetween(referenceDate, END_DATE);
   final DepositZero expected =
       new DepositZero(
           EUR,
           startTime,
           endTime,
           NOTIONAL,
           NOTIONAL,
           DEPOSIT_AF,
           RATE,
           DEPOSIT_DEFINITION.getInterestAmount());
   assertEquals("DepositZeroDefinition: toDerivative", expected, converted);
 }
 @SuppressWarnings("deprecation")
 @Test
 /** Tests toDerivative. */
 public void toDerivativeBetweenSettleMaturityDeprecated() {
   final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 12, 20);
   final DepositZero converted = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVE_NAME);
   final double startTime = 0;
   final double endTime = TimeCalculator.getTimeBetween(referenceDate, END_DATE);
   final DepositZero expected =
       new DepositZero(
           EUR,
           startTime,
           endTime,
           0.0,
           NOTIONAL,
           DEPOSIT_AF,
           RATE,
           DEPOSIT_DEFINITION.getInterestAmount(),
           CURVE_NAME);
   assertEquals("DepositZeroDefinition: toDerivative", expected, converted);
 }
 @Test
 /** Tests the getters */
 public void getter() {
   assertEquals("DepositZeroDefinition: getter", SPOT_DATE, DEPOSIT_DEFINITION.getStartDate());
   assertEquals("DepositZeroDefinition: getter", END_DATE, DEPOSIT_DEFINITION.getEndDate());
   assertEquals("DepositZeroDefinition: getter", NOTIONAL, DEPOSIT_DEFINITION.getNotional());
   assertEquals("DepositZeroDefinition: getter", RATE, DEPOSIT_DEFINITION.getRate());
   assertEquals("DepositZeroDefinition: getter", EUR, DEPOSIT_DEFINITION.getCurrency());
   assertEquals(
       "DepositZeroDefinition: getter", DEPOSIT_AF, DEPOSIT_DEFINITION.getPaymentAccrualFactor());
   final double interestAmount = (1.0 / RATE.getDiscountFactor(DEPOSIT_AF) - 1) * NOTIONAL;
   assertEquals(
       "DepositZeroDefinition: getter", interestAmount, DEPOSIT_DEFINITION.getInterestAmount());
 }
 @Test
 /** Tests the equal and hash code methods. */
 public void equalHash() {
   assertEquals("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION, DEPOSIT_DEFINITION);
   final DepositZeroDefinition other =
       new DepositZeroDefinition(EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
   assertEquals("DepositZeroDefinition: equal-hash code", other, DEPOSIT_DEFINITION);
   assertEquals(
       "DepositZeroDefinition: equal-hash code", other.hashCode(), DEPOSIT_DEFINITION.hashCode());
   DepositZeroDefinition modified;
   modified =
       new DepositZeroDefinition(Currency.USD, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
   modified =
       new DepositZeroDefinition(
           Currency.EUR, SPOT_DATE.plusDays(1), END_DATE, NOTIONAL, DEPOSIT_AF, RATE);
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
   modified =
       new DepositZeroDefinition(
           Currency.EUR, SPOT_DATE, END_DATE.plusDays(1), NOTIONAL, DEPOSIT_AF, RATE);
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
   modified =
       new DepositZeroDefinition(
           Currency.EUR, SPOT_DATE, END_DATE, NOTIONAL + 1000, DEPOSIT_AF, RATE);
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
   modified =
       new DepositZeroDefinition(
           Currency.EUR, SPOT_DATE, END_DATE, NOTIONAL, DEPOSIT_AF + 0.01, RATE);
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
   modified =
       new DepositZeroDefinition(
           Currency.EUR,
           SPOT_DATE,
           END_DATE,
           NOTIONAL,
           DEPOSIT_AF,
           new PeriodicInterestRate(RATE_FIGURE, 1));
   assertFalse("DepositZeroDefinition: equal-hash code", DEPOSIT_DEFINITION.equals(modified));
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void nullDayCount() {
   DepositZeroDefinition.from(EUR, SPOT_DATE, END_DATE, null, RATE, CALENDAR);
 }