List<ClientApplicationContextProducer> producers = new ArrayList<ClientApplicationContextProducer>();
producers.add(notSupportedApplicationContextProducer);
producers.add(supportedApplicationContextProducer);
ServiceLoader serviceLoader = mock(ServiceLoader.class);
when(serviceLoader.all(ClientApplicationContextProducer.class)).thenReturn(producers);
Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
when(mockServiceLoader.get()).thenReturn(serviceLoader);
TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);