DockerCommandExecutor { public static DockerContainerStatus getContainerStatus(String containerId, PrivilegedOperationExecutor privilegedOperationExecutor, Context nmContext) { try { String currentContainerStatus = executeStatusCommand(containerId, privilegedOperationExecutor, nmContext); DockerContainerStatus dockerContainerStatus = parseContainerStatus( currentContainerStatus); if (LOG.isDebugEnabled()) { LOG.debug("Container Status: " + dockerContainerStatus.getName() + " ContainerId: " + containerId); } return dockerContainerStatus; } catch (ContainerExecutionException e) { if (LOG.isDebugEnabled()) { LOG.debug("Container Status: " + DockerContainerStatus.NONEXISTENT.getName() + " ContainerId: " + 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)); } }