SolrCloudCollectionProxyFactory { public <C extends CollectionProxy> C create(Class<C> type) { try { Constructor<C> constructor = type.getConstructor(SolrClient.class); return constructor.newInstance(cloudSolrClient); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } } SolrCloudCollectionProxyFactory(CloudSolrClient cloudSolrClient); C create(Class<C> type);  }
@Test void exceptionsOfIncorrectArgsConstructorsAreWrapped() { assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> subject.create(NullaryConstructorCollectionProxy.class)) .withCauseInstanceOf(NoSuchMethodException.class); assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> subject.create(TwoArgConstructorCollectionProxy.class)) .withCauseInstanceOf(NoSuchMethodException.class); }