### Question:
ObjectFactoryImpl implements ObjectFactory, Serializable { @Override public ObjectFactoryInstance createInstance(final String type) { final ObjectRecipe recipe = new ObjectRecipe(type); recipe.setRegistry(registry); return new ObjectFactoryInstanceImpl(recipe); }  @Override ObjectFactoryInstance createInstance(final String type);  }### Answer:
@Test void createDefaults() { assertEquals("test(setter)/0", factory .createInstance("org.talend.sdk.component.runtime.manager.service.ObjectFactoryImplTest$Created") .ignoreUnknownProperties() .withProperties(new HashMap<String, String>() { { put("name", "test"); put("age", "30"); } }) .create(Supplier.class) .get()); }
@Test void createFields() { assertEquals("test/30", factory .createInstance("org.talend.sdk.component.runtime.manager.service.ObjectFactoryImplTest$Created") .withFieldInjection() .withProperties(new HashMap<String, String>() { { put("name", "test"); put("age", "30"); } }) .create(Supplier.class) .get()); }
@Test void failOnUnknown() { assertThrows(IllegalArgumentException.class, () -> factory .createInstance("org.talend.sdk.component.runtime.manager.service.ObjectFactoryImplTest$Created") .withProperties(new HashMap<String, String>() { { put("name", "test"); put("age", "30"); } }) .create(Supplier.class)); }