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