### Question:
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { public boolean deletePod (KubernetesPodContainer instance) { log.debug("Deleting pod {}", v(DATADOG_CONTAINER_KEY, instance)); try { V1DeleteOptions deleteOptions = new V1DeleteOptionsBuilder().withGracePeriodSeconds(0L).build(); getCoreV1Api().deleteNamespacedPod(instance.getPodName(), instance.getNamespace(), "false", null, null, null, "Foreground", deleteOptions); } catch (JsonSyntaxException e1) { log.debug("Normal exception, see https: } catch (ApiException e) { log.error("Could not delete pod", e); return false; } return true; } @Autowired  KubernetesPlatform(ApiClient apiClient); String getNamespace(); void setNamespace(String namespace); ContainerHealth checkHealth(KubernetesPodContainer kubernetesPodContainer); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override boolean isContainerRecycled(Container container); ContainerHealth replicaSetRecovered(KubernetesPodContainer kubernetesPodContainer); boolean isDesiredReplicas(KubernetesPodContainer instance); @Override void recycleContainer(KubernetesPodContainer container); boolean deletePod(KubernetesPodContainer instance); @Override ShellClient getConnectedShellClient(KubernetesPodContainer container);  }### Answer:
@Test public void testDeletePod () throws ApiException { when(coreV1Api.listNamespacedPod(anyString(), anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyInt(), anyString(), anyInt(), anyBoolean())).thenReturn(getV1PodList(true)); boolean result = platform.deletePod((KubernetesPodContainer) platform.getRoster().get(0)); assertTrue(result); verify(coreV1Api, times(1)).deleteNamespacedPod(any(), any(), any(), any(), any(), any(), any(), any()); }
@Test public void testDeletePodAPIException () throws ApiException { when(coreV1Api.listNamespacedPod(anyString(), anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyInt(), anyString(), anyInt(), anyBoolean())).thenReturn(getV1PodList(true)); when(coreV1Api.deleteNamespacedPod(any(), any(), any(), any(), any(), any(), any(), any())).thenThrow(new ApiException()); boolean result = platform.deletePod((KubernetesPodContainer) platform.getRoster().get(0)); assertFalse(result); verify(coreV1Api, times(1)).deleteNamespacedPod(any(), any(), any(), any(), any(), any(), any(), any()); }
@Test public void testDeletePodJSONSyntaxException () throws ApiException { when(coreV1Api.listNamespacedPod(anyString(), anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyInt(), anyString(), anyInt(), anyBoolean())).thenReturn(getV1PodList(true)); when(coreV1Api.deleteNamespacedPod(any(), any(), any(), any(), any(), any(), any(), any())).thenThrow(new JsonSyntaxException("")); boolean result = platform.deletePod((KubernetesPodContainer) platform.getRoster().get(0)); assertTrue(result); verify(coreV1Api, times(1)).deleteNamespacedPod(any(), any(), any(), any(), any(), any(), any(), any()); }