Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
when(mockServiceLoader.get()).thenReturn(serviceLoader);
TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);
ApplicationContext applicationContext = mock(ApplicationContext.class);
RemoteTestScopeApplicationContext containerTestScopeApplicationContext =
new RemoteTestScopeApplicationContext(applicationContext, new TestClass(Object.class), true);
InstanceProducer<RemoteTestScopeApplicationContext> mockApplicationContext = mock(InstanceProducer.class);
when(mockApplicationContext.get()).thenReturn(containerTestScopeApplicationContext);
TestReflectionHelper.setFieldValue(instance, "applicationContextInstance", mockApplicationContext);