@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testCreateObject_All() { Class modelClasses[] = { APIResponse.class, APIResponses.class, Callback.class, Components.class, Contact.class, Content.class, Discriminator.class, Encoding.class, Example.class, ExternalDocumentation.class, Header.class, Info.class, License.class, Link.class, MediaType.class, OAuthFlow.class, OAuthFlows.class, OpenAPI.class, Operation.class, Parameter.class, PathItem.class, Paths.class, RequestBody.class, Schema.class, SecurityRequirement.class, SecurityScheme.class, Server.class, ServerVariable.class, Tag.class, XML.class }; for (Class modelClass : modelClasses) { Constructible object = OASFactory.createObject(modelClass); Assert.assertNotNull(object); } }
@SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } } }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  @SuppressWarnings("unchecked") @Override T createObject(Class<T> clazz); }
OASFactoryResolverImpl extends OASFactoryResolver { @SuppressWarnings("unchecked") @Override public <T extends Constructible> T createObject(Class<T> clazz) { if (clazz == null) { throw new NullPointerException(); } Class<? extends Constructible> implClass = registry.get(clazz); if (implClass == null) { throw SpiMessages.msg.classNotConstructible(clazz.getName()); } try { return (T) implClass.getConstructor().newInstance(); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }  @SuppressWarnings("unchecked") @Override T createObject(Class<T> clazz);  }