### Question:
ModelFactory implements ResourceModelFactory { @Override public <T> T provideModel(@Nonnull ModelDefinition<T> modelDefinition, @Nonnull ContentToModelMappingCallback<T> callback) { @SuppressWarnings("unchecked") ModelInstantiator<T> modelInstantiator = (ModelInstantiator<T>) this.modelMetadata.get(modelDefinition); if (modelInstantiator == null) { throw new IllegalStateException("Unable to instantiate " + modelDefinition + ", there is no model metadata for this model type in this factory."); } try { T model = modelInstantiator.create(this.bundle.getBundleContext()); model = callback.map(model); modelInstantiator.postProcessAfterInitialization(model); return model; } catch (ReflectiveOperationException e) { throw new ModelInstantiationException("Unable to instantiate model " + modelDefinition, e); } } ModelFactory(Bundle bundle); @Nonnull @Override Collection<ModelDefinition<?>> getModelDefinitions(); @Override T provideModel(@Nonnull ModelDefinition<T> modelDefinition, @Nonnull ContentToModelMappingCallback<T> callback);  }### Answer:
@Test(expected = IllegalStateException.class) @SuppressWarnings("unchecked") public void testHandlingOfMissingModelForModelDefinition() { this.testee.provideModel(mock(ModelDefinition.class), this.callback); }