@Test
public void trimPreviousManagedEnv() {

    TestImage img = dockerClient.newLocalImage("resolved-image", "latest");
    img.env(DockerCloudUtils.ENV_PREFIX + "FOO1", "bar1");
    img.env("FOO2", "bar2");
    DefaultDockerClientFacade facade = new DefaultDockerClientFacade(dockerClient);
    facade.createAgent(CreateAgentParameters.from(Node.EMPTY_OBJECT).
            imageName("resolved-image:latest"));
    Container container = dockerClient.getContainers().get(0);
    assertThat(container.getEnv()).containsEntry(DockerCloudUtils.ENV_PREFIX + "FOO1", "")
            .containsEntry("FOO2", "bar2");
}