@Test
public void testToDerivative() {
MetalFutureOptionDefinition first = new MetalFutureOptionDefinition(EXPIRY_DATE, AN_UNDERLYING, 100, ExerciseDecisionType.EUROPEAN, true);
MetalFutureOptionDefinition second = new MetalFutureOptionDefinition(EXPIRY_DATE, AN_UNDERLYING, 100, ExerciseDecisionType.AMERICAN, false);
MetalFutureOption firstDerivative = first.toDerivative(A_DATE);
MetalFutureOption 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());
MetalFutureOption firstDerivative2 = new MetalFutureOption(0.0027397260273972603, AN_UNDERLYING.toDerivative(A_DATE), 100, ExerciseDecisionType.EUROPEAN, true);
assertEquals(firstDerivative.hashCode(), firstDerivative2.hashCode());
assertEquals(firstDerivative, firstDerivative2);
}