### Question:
ClusterAccess { public RuntimeMode resolveRuntimeMode(RuntimeMode mode, KitLogger log) { RuntimeMode resolvedMode; if (mode == null) { mode = RuntimeMode.DEFAULT; } if (mode.isAuto()) { resolvedMode = isOpenShiftImageStream(log) ? RuntimeMode.openshift : RuntimeMode.kubernetes; } else { resolvedMode = mode; } return resolvedMode; } ClusterAccess(ClusterConfiguration clusterConfiguration); @Deprecated  ClusterAccess(String namespace);  ClusterAccess(ClusterConfiguration clusterConfiguration, KubernetesClient client); T createDefaultClient(KitLogger log); KubernetesClient createKubernetesClient(); OpenShiftClient createOpenShiftClient(); String getNamespace(); boolean isOpenShiftImageStream(KitLogger log); boolean isOpenShift(KitLogger log); RuntimeMode resolveRuntimeMode(RuntimeMode mode, KitLogger log);  }### Answer:
@Test public void openshiftRuntimeModeTest() throws Exception { paths.add("/oapi"); paths.add("/oapi/v1"); RootPaths rootpaths = new RootPaths(); rootpaths.setPaths(paths); mockServer.expect().get().withPath("/" ).andReturn(200, rootpaths).always(); mockServer.expect().withPath("/apis").andReturn(200, new APIGroupListBuilder() .addNewGroup() .withApiVersion("v1") .withName("autoscaling.k8s.io") .endGroup() .addNewGroup() .withApiVersion("v1") .withName("security.openshift.io") .endGroup() .build()).always(); ClusterAccess clusterAccess = new ClusterAccess(null, client); mode = clusterAccess.resolveRuntimeMode(RuntimeMode.openshift, logger); assertEquals(RuntimeMode.openshift, mode); mode = clusterAccess.resolveRuntimeMode(RuntimeMode.DEFAULT, logger); assertEquals(RuntimeMode.openshift, mode); mode = clusterAccess.resolveRuntimeMode(null, logger); assertEquals(RuntimeMode.openshift, mode); }
@Test public void kubernetesRuntimeModeTest() throws Exception { RootPaths rootpaths = new RootPaths(); rootpaths.setPaths(paths); mockServer.expect().get().withPath("/" ).andReturn(200, rootpaths).always(); ClusterAccess clusterAccess = new ClusterAccess(null, client); mode = clusterAccess.resolveRuntimeMode(RuntimeMode.kubernetes, logger); assertEquals(RuntimeMode.kubernetes, mode); mode = clusterAccess.resolveRuntimeMode(RuntimeMode.DEFAULT, logger); assertEquals(RuntimeMode.kubernetes, mode); mode = clusterAccess.resolveRuntimeMode(null, logger); assertEquals(RuntimeMode.kubernetes, mode); }