### Question:
DockerInfoParser implements ParametersParser<DockerInfo> { @Override public DockerInfo parse(List<Map<String, Object>> parametersList) { Map<String, String> dockerParams = getDockerParams(parametersList); return getDockerInfo(dockerParams); }  @Override DockerInfo parse(List<Map<String, Object>> parametersList);  }### Answer:
@Test void testWithValidImageWithoutUserCredentials() { List<Map<String, Object>> parameters = new ArrayList<>(); Map<String, Object> moduleParameters = new HashMap<>(); Map<String, String> dockerParameters = new HashMap<>(); String sampleImage = "cloudfoundry/test-app"; dockerParameters.put("image", sampleImage); moduleParameters.put("docker", dockerParameters); parameters.add(moduleParameters); DockerInfo actualDockerInfo = dockerInfoParser.parse(parameters); DockerInfo expectedDockerInfo = ImmutableDockerInfo.builder() .image(sampleImage) .build(); assertEquals(expectedDockerInfo, actualDockerInfo); }
@Test void testWithValidImageAndCredentials() { List<Map<String, Object>> parameters = new ArrayList<>(); Map<String, Object> moduleParameters = new HashMap<>(); Map<String, String> dockerParameters = new HashMap<>(); String sampleImage = "cloudfoundry/test-app"; String username = "someUsername"; String password = "somePassword"; dockerParameters.put("image", sampleImage); dockerParameters.put("username", username); dockerParameters.put("password", password); moduleParameters.put("docker", dockerParameters); parameters.add(moduleParameters); DockerInfo actualDockerInfo = dockerInfoParser.parse(parameters); DockerInfo expectedDockerInfo = creteDockerInfo(sampleImage, username, password); assertEquals(expectedDockerInfo, actualDockerInfo); }
@Test void testWithoutArguments() { List<Map<String, Object>> parameters = new ArrayList<>(); Map<String, Object> moduleParameters = new HashMap<>(); Map<String, String> dockerParameters = new HashMap<>(); moduleParameters.put("docker", dockerParameters); parameters.add(moduleParameters); DockerInfo actualDockerInfo = dockerInfoParser.parse(parameters); assertNull(actualDockerInfo); }
@Test void testWithoutDocker() { List<Map<String, Object>> parameters = Collections.emptyList(); DockerInfo dockerInfo = dockerInfoParser.parse(parameters); assertNull(dockerInfo); }