@Test
public void listAgentContainers() {

    DefaultDockerClientFacade facade = new DefaultDockerClientFacade(dockerClient);
    TestImage img = dockerClient.newLocalImage("image-1", "latest");
    assertThat(facade.listAgentHolders("foo", "bar")).isEmpty();
    Container container = new Container().
            label("foo", "bar").
            label(DockerCloudUtils.SOURCE_IMAGE_ID_LABEL, img.getId()).
            name("the_container_name").
            image(img).
            creationTimestamp(TestUtils.TEST_INSTANT).
            running(true);
    dockerClient.container(container);
    List<AgentHolderInfo>  agentHolders = facade.
            listAgentHolders("foo", "bar");
    assertThat(agentHolders).hasSize(1);
    AgentHolderInfo agentHolder = agentHolders.get(0);
    assertThat(agentHolder.getId()).isEqualTo(container.getId());
    assertThat(agentHolder.getTaskId()).isEqualTo(container.getId());
    assertThat(agentHolder.getName()).isEqualTo("the_container_name");
    assertThat(agentHolder.getStateMsg()).isEqualTo(DefaultDockerClientFacade.CONTAINER_RUNNING_STATE);
    assertThat(agentHolder.getLabels()).isEqualTo(
            mapOf(pair("foo", "bar"), pair(DockerCloudUtils.SOURCE_IMAGE_ID_LABEL, img.getId())));
    assertThat(agentHolder.getCreationTimestamp()).isEqualTo(TestUtils.TEST_INSTANT);
    assertThat(agentHolder.isRunning()).isTrue();
}