### Question:
ModelFactory implements ResourceModelFactory { @Nonnull @Override public Collection<ModelDefinition<?>> getModelDefinitions() { return this.modelDefinitions; } ModelFactory(Bundle bundle); @Nonnull @Override Collection<ModelDefinition<?>> getModelDefinitions(); @Override T provideModel(@Nonnull ModelDefinition<T> modelDefinition, @Nonnull ContentToModelMappingCallback<T> callback);  }### Answer:
@Test public void testModelFactoryFindsResourceModel() { assertThat(this.testee.getModelDefinitions()) .hasSize(1); assertThat(this.testee.getModelDefinitions().iterator().next().getType()) .isSameAs(ModelClass.class); assertThat(this.testee.getModelDefinitions().iterator().next().getName()) .isEqualTo("modelClass"); assertThat(this.testee.getModelDefinitions().iterator().next().getResourceModel()) .isSameAs(ModelClass.class.getAnnotation(ResourceModel.class)); }
@Test(expected = UnsupportedOperationException.class) public void testModelDefinitionsAreUnmodifiable() { this.testee.getModelDefinitions().add(mock(ModelDefinition.class)); }