public void testToDerivative() {
AgricultureForwardDefinition first = new AgricultureForwardDefinition(EXPIRY_DATE, AN_UNDERLYING, 100., null, null, 1000., "tonnes", SettlementType.CASH, 0, Currency.GBP, SETTLEMENT_DATE);
AgricultureForwardDefinition second = new AgricultureForwardDefinition(EXPIRY_DATE, AN_UNDERLYING, 100., FIRST_DELIVERY_DATE, LAST_DELIVERY_DATE, 1000., "tonnes", SettlementType.PHYSICAL, 0,
Currency.GBP, SETTLEMENT_DATE);
AgricultureForward firstDerivative = first.toDerivative(A_DATE);
AgricultureForward secondDerivative = second.toDerivative(A_DATE);
assertEquals(firstDerivative.getAmount(), 1000.);
assertEquals(firstDerivative.getUnitAmount(), 100.);
assertEquals(firstDerivative.getUnitName(), "tonnes");
assertEquals(firstDerivative.getExpiry(), 0.0027397260273972603);
assertNull(firstDerivative.getFirstDeliveryDate());
assertNull(firstDerivative.getLastDeliveryDate());
assertEquals(firstDerivative.getSettlementType(), SettlementType.CASH);
assertEquals(firstDerivative.getUnderlying(), AN_UNDERLYING);
assertEquals(secondDerivative.getFirstDeliveryDate(), FIRST_DELIVERY_DATE);
assertEquals(secondDerivative.getLastDeliveryDate(), LAST_DELIVERY_DATE);
assertEquals(secondDerivative.getSettlementType(), SettlementType.PHYSICAL);
AgricultureForward firstDerivative2 = new AgricultureForward(0.0027397260273972603, AN_UNDERLYING, 100, null, null, 1000, "tonnes", SettlementType.CASH, 1.0035032562317538, 0, Currency.GBP);
assertEquals(firstDerivative.hashCode(), firstDerivative2.hashCode());
assertEquals(firstDerivative, firstDerivative2);
}