@Test
public void testToDerivative() {
EnergyFutureOptionDefinition first = new EnergyFutureOptionDefinition(EXPIRY_DATE, AN_UNDERLYING, 100, ExerciseDecisionType.EUROPEAN, true);
EnergyFutureOptionDefinition second = new EnergyFutureOptionDefinition(EXPIRY_DATE, AN_UNDERLYING, 100, ExerciseDecisionType.AMERICAN, false);
EnergyFutureOption firstDerivative = first.toDerivative(A_DATE);
EnergyFutureOption secondDerivative = second.toDerivative(A_DATE);
assertEquals(firstDerivative.getStrike(), 100.);
assertEquals(firstDerivative.getExerciseType(), ExerciseDecisionType.EUROPEAN);
assertEquals(firstDerivative.getUnderlying(), AN_UNDERLYING.toDerivative(A_DATE));
assertTrue(firstDerivative.isCall());
assertEquals(secondDerivative.getExerciseType(), ExerciseDecisionType.AMERICAN);
assertFalse(secondDerivative.isCall());
EnergyFutureOption firstDerivative2 = new EnergyFutureOption(0.0027397260273972603, AN_UNDERLYING.toDerivative(A_DATE), 100, ExerciseDecisionType.EUROPEAN, true);
assertEquals(firstDerivative.hashCode(), firstDerivative2.hashCode());
assertEquals(firstDerivative, firstDerivative2);
}