### Question:
BondFutureOptionSecurity implements Security, ImmutableBean, Serializable { @Override public BondFutureOption createProduct(ReferenceData refData) { Security security = refData.getValue(underlyingFutureId); if (!(security instanceof BondFutureSecurity)) { throw new ClassCastException(Messages.format( "{} underlying future '{}' resolved to '{}' when '{}' was expected", BondFutureOptionSecurity.class.getSimpleName(), underlyingFutureId, security.getClass().getSimpleName(), BondFutureSecurity.class.getSimpleName())); } BondFutureSecurity futureSec = (BondFutureSecurity) security; BondFuture underlying = futureSec.createProduct(refData); return new BondFutureOption( getSecurityId(), putCall, strikePrice, expiryDate, expiryTime, expiryZone, premiumStyle, rounding, underlying); } private  BondFutureOptionSecurity(
      SecurityInfo info,
      Currency currency,
      PutCall putCall,
      double strikePrice,
      LocalDate expiryDate,
      LocalTime expiryTime,
      ZoneId expiryZone,
      FutureOptionPremiumStyle premiumStyle,
      Rounding rounding,
      SecurityId underlyingFutureId); @Override ImmutableSet<SecurityId> getUnderlyingIds(); @Override BondFutureOptionSecurity withInfo(SecurityInfo info); @Override BondFutureOption createProduct(ReferenceData refData); @Override BondFutureOptionTrade createTrade(TradeInfo info, double quantity, double tradePrice, ReferenceData refData); @Override BondFutureOptionPosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData); @Override BondFutureOptionPosition createPosition(
      PositionInfo positionInfo,
      double longQuantity,
      double shortQuantity,
      ReferenceData refData); static BondFutureOptionSecurity.Meta meta(); static BondFutureOptionSecurity.Builder builder(); @Override BondFutureOptionSecurity.Meta metaBean(); @Override SecurityInfo getInfo(); @Override Currency getCurrency(); PutCall getPutCall(); double getStrikePrice(); LocalDate getExpiryDate(); LocalTime getExpiryTime(); ZoneId getExpiryZone(); FutureOptionPremiumStyle getPremiumStyle(); Rounding getRounding(); SecurityId getUnderlyingFutureId(); Builder toBuilder(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void test_createProduct_wrongType() { BondFutureOptionSecurity test = sut(); BondFuture future = PRODUCT.getUnderlyingFuture(); SecurityId secId = future.getSecurityId(); GenericSecurity sec = GenericSecurity.of(INFO); ReferenceData refData = ImmutableReferenceData.of(secId, sec); assertThatExceptionOfType(ClassCastException.class) .isThrownBy(() -> test.createProduct(refData)); }