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