@Test void concreteClassesShouldBeCreatedAsExpected() { String string = objenesisObjectFactory.createInstance(String.class, context); assertThat(string).isNotNull(); }
@Override public <T> T createInstance(Class<T> type, RandomizerContext context) { if (context.getParameters().isScanClasspathForConcreteTypes() && isAbstract(type)) { Class<?> randomConcreteSubType = randomElementOf(getPublicConcreteSubTypesOf((type))); if (randomConcreteSubType == null) { throw new InstantiationError("Unable to find a matching concrete subtype of type: " + type + " in the classpath"); } else { return (T) createNewInstance(randomConcreteSubType); } } else { try { return createNewInstance(type); } catch (Error e) { throw new ObjectCreationException("Unable to create an instance of type: " + type, e); } } }
ObjenesisObjectFactory implements ObjectFactory { @Override public <T> T createInstance(Class<T> type, RandomizerContext context) { if (context.getParameters().isScanClasspathForConcreteTypes() && isAbstract(type)) { Class<?> randomConcreteSubType = randomElementOf(getPublicConcreteSubTypesOf((type))); if (randomConcreteSubType == null) { throw new InstantiationError("Unable to find a matching concrete subtype of type: " + type + " in the classpath"); } else { return (T) createNewInstance(randomConcreteSubType); } } else { try { return createNewInstance(type); } catch (Error e) { throw new ObjectCreationException("Unable to create an instance of type: " + type, e); } } } }
ObjenesisObjectFactory implements ObjectFactory { @Override public <T> T createInstance(Class<T> type, RandomizerContext context) { if (context.getParameters().isScanClasspathForConcreteTypes() && isAbstract(type)) { Class<?> randomConcreteSubType = randomElementOf(getPublicConcreteSubTypesOf((type))); if (randomConcreteSubType == null) { throw new InstantiationError("Unable to find a matching concrete subtype of type: " + type + " in the classpath"); } else { return (T) createNewInstance(randomConcreteSubType); } } else { try { return createNewInstance(type); } catch (Error e) { throw new ObjectCreationException("Unable to create an instance of type: " + type, e); } } }  }
ObjenesisObjectFactory implements ObjectFactory { @Override public <T> T createInstance(Class<T> type, RandomizerContext context) { if (context.getParameters().isScanClasspathForConcreteTypes() && isAbstract(type)) { Class<?> randomConcreteSubType = randomElementOf(getPublicConcreteSubTypesOf((type))); if (randomConcreteSubType == null) { throw new InstantiationError("Unable to find a matching concrete subtype of type: " + type + " in the classpath"); } else { return (T) createNewInstance(randomConcreteSubType); } } else { try { return createNewInstance(type); } catch (Error e) { throw new ObjectCreationException("Unable to create an instance of type: " + type, e); } } }  @Override T createInstance(Class<T> type, RandomizerContext context); }
ObjenesisObjectFactory implements ObjectFactory { @Override public <T> T createInstance(Class<T> type, RandomizerContext context) { if (context.getParameters().isScanClasspathForConcreteTypes() && isAbstract(type)) { Class<?> randomConcreteSubType = randomElementOf(getPublicConcreteSubTypesOf((type))); if (randomConcreteSubType == null) { throw new InstantiationError("Unable to find a matching concrete subtype of type: " + type + " in the classpath"); } else { return (T) createNewInstance(randomConcreteSubType); } } else { try { return createNewInstance(type); } catch (Error e) { throw new ObjectCreationException("Unable to create an instance of type: " + type, e); } } }  @Override T createInstance(Class<T> type, RandomizerContext context);  }