DockerCommandExecutor { public static DockerContainerStatus getContainerStatus(String containerId, PrivilegedOperationExecutor privilegedOperationExecutor, Context nmContext) { try { String currentContainerStatus = executeStatusCommand(containerId, privilegedOperationExecutor, nmContext); DockerContainerStatus dockerContainerStatus = parseContainerStatus( currentContainerStatus); LOG.debug("Container Status: {} ContainerId: {}", dockerContainerStatus.getName(), containerId); return dockerContainerStatus; } catch (ContainerExecutionException e) { LOG.debug("Container Status: {} ContainerId: {}", DockerContainerStatus.NONEXISTENT.getName(), containerId); return DockerContainerStatus.NONEXISTENT; } } private  DockerCommandExecutor(); static String executeDockerCommand(DockerCommand dockerCommand,
      String containerId, Map<String, String> env,
      PrivilegedOperationExecutor privilegedOperationExecutor,
      boolean disableFailureLogging, Context nmContext); static DockerContainerStatus getContainerStatus(String containerId,
      PrivilegedOperationExecutor privilegedOperationExecutor,
      Context nmContext); static DockerContainerStatus parseContainerStatus(
      String containerStatusStr); static boolean isStoppable(DockerContainerStatus containerStatus); static boolean isKillable(DockerContainerStatus containerStatus); static boolean isRemovable(DockerContainerStatus containerStatus); static boolean isStartable(DockerContainerStatus containerStatus);  }
@Test public void testGetContainerStatus() throws Exception { for (DockerContainerStatus status : DockerContainerStatus.values()) { when(mockExecutor.executePrivilegedOperation(eq(null), any(PrivilegedOperation.class), eq(null), any(), eq(true), eq(false))) .thenReturn(status.getName()); assertEquals(status, DockerCommandExecutor.getContainerStatus( MOCK_CONTAINER_ID, mockExecutor, nmContext)); } }