### Question:
WebClientFactoryImpl implements WebClientFactory { static Constructor<? extends WebClient> getClientConstructor() { for (String className : CLIENT_CLASS_NAMES) { try { return getClientConstructor(className); } catch (NoClassDefFoundError | NoSuchMethodException ignored) { } } throw new IllegalStateException("Unable to select client constructor"); }  @Override WebClient createClient();  }### Answer:
@Test public void whenApacheClientDependentClassesFound_selectApacheClient() { assertThat(WebClientFactoryImpl.getClientConstructor().getDeclaringClass(), sameInstance(WebClientImpl.class)); }
@Test public void whenApacheClientDependentClassesMissing_selectJKD8Client() throws NoSuchFieldException { mementos.add(StaticStubSupport.install(WebClientFactoryImpl.class, "loadClientClass", apacheClassesMissing)); assertThat(WebClientFactoryImpl.getClientConstructor().getDeclaringClass(), sameInstance(WebClient8Impl.class)); }