ComplexChooserOptionDefinition extends OptionDefinition { public double getTimeToPutExpiry(final ZonedDateTime date) { if (date.isAfter(getPutExpiry().getExpiry())) { throw new IllegalArgumentException("Date " + date + " is after put expiry " + getPutExpiry()); } return DateUtils.getDifferenceInYears(date, getPutExpiry().getExpiry()); } ComplexChooserOptionDefinition(final Expiry chooseDate, final double callStrike, final Expiry callExpiry, final double putStrike, final Expiry putExpiry); double getCallStrike(); double getPutStrike(); Expiry getCallExpiry(); Expiry getPutExpiry(); double getTimeToCallExpiry(final ZonedDateTime date); double getTimeToPutExpiry(final ZonedDateTime date); OptionDefinition getCallDefinition(); OptionDefinition getPutDefinition(); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testPutExpiryTime() { CHOOSER.getTimeToPutExpiry(DateUtils.getDateOffsetWithYearFraction(DATE, 5)); }