Source:
<code>public void setup() throws Exception { MockitoAnnotations.initMocks(this); <START> internalRuntimeSpy = <END> spy(new OpenShiftInternalRuntime( 13, new URLRewriter.NoOpURLRewriter(), eventService, bootstrapperFactory, serverCheckerFactory, context, project)); when(context.getOpenShiftEnvironment()).thenReturn(osEnv); when(serverCheckerFactory.create(any(), anyString(), any())).thenReturn(serversChecker); when(context.getIdentity()).thenReturn(IDENTITY); doNothing().when(project).cleanUp(); when(project.services()).thenReturn(services); when(project.routes()).thenReturn(routes); when(project.pods()).thenReturn(pods); when(bootstrapperFactory.create(any(), anyListOf(Installer.class), any())) .thenReturn(bootstrapper); when(context.getEnvironment()).thenReturn(environment); doReturn(ImmutableMap.of(M1_NAME, mockMachine(), M2_NAME, mockMachine())) .when(environment) .getMachines(); final Map<String, Service> allServices = ImmutableMap.of(SERVICE_NAME, mockService()); final Map<String, Route> allRoutes = ImmutableMap.of(SERVICE_NAME, mockRoute()); final Container container = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container))); when(services.create(any())).thenAnswer(a -> a.getArguments()[0]); when(routes.create(any())).thenAnswer(a -> a.getArguments()[0]); when(pods.create(any())).thenAnswer(a -> a.getArguments()[0]); when(osEnv.getServices()).thenReturn(allServices); when(osEnv.getRoutes()).thenReturn(allRoutes); when(osEnv.getPods()).thenReturn(allPods); }</code><technical_language>need spy here</technical_language>

Target:
public void setup() throws Exception { MockitoAnnotations.initMocks(this); internalRuntime = new OpenShiftInternalRuntime( 13, new URLRewriter.NoOpURLRewriter(), eventService, bootstrapperFactory, serverCheckerFactory, context, project); when(context.getOpenShiftEnvironment()).thenReturn(osEnv); when(serverCheckerFactory.create(any(), anyString(), any())).thenReturn(serversChecker); when(context.getIdentity()).thenReturn(IDENTITY); doNothing().when(project).cleanUp(); when(project.services()).thenReturn(services); when(project.routes()).thenReturn(routes); when(project.pods()).thenReturn(pods); when(bootstrapperFactory.create(any(), anyListOf(Installer.class), any())) .thenReturn(bootstrapper); when(context.getEnvironment()).thenReturn(environment); doReturn(ImmutableMap.of(M1_NAME, mockMachine(), M2_NAME, mockMachine())) .when(environment) .getMachines(); allServices = ImmutableMap.of(SERVICE_NAME, mockService()); allRoutes = ImmutableMap.of(SERVICE_NAME, mockRoute()); final Container container = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container))); when(services.create(any())).thenAnswer(a -> a.getArguments()[0]); when(routes.create(any())).thenAnswer(a -> a.getArguments()[0]); when(pods.create(any())).thenAnswer(a -> a.getArguments()[0]); when(osEnv.getServices()).thenReturn(allServices); when(osEnv.getRoutes()).thenReturn(allRoutes); when(osEnv.getPods()).thenReturn(allPods); }