### Question:
PDSServerConfigurationValidator { public String createValidationErrorMessage(PDSServerConfiguration configuration) { if (configuration == null) { return "configuration may not be null!"; } String serverId = configuration.getServerId(); String serverIdProblem = serverIdValidator.createValidationErrorMessage(serverId); if (serverIdProblem != null) { return "server id problem:"+serverIdProblem; } List<PDSProductSetup> products = configuration.getProducts(); if (products.size() == 0) { return "at least one product setup must be defined, but there is none!"; } for (PDSProductSetup setup : products) { String productId = setup.getId(); String productIdErrorMessage = productIdValidator.createValidationErrorMessage(productId); if (productIdErrorMessage != null) { return productIdErrorMessage; } String path = setup.getPath(); String pathProblem = pathExecutableValidator.createValidationErrorMessage(path); if (pathProblem != null) { return "setup of product:" + productId + " invalid, because path problem:" + pathProblem; } } return null; }  String createValidationErrorMessage(PDSServerConfiguration configuration);  }### Answer:
@Test public void nullConfigurationIsNotValid() { assertNotValid(validatorToTest.createValidationErrorMessage(null)); }
@Test public void anEmptyConfigurationIsNotValid() { assertNotValid(validatorToTest.createValidationErrorMessage(configuration)); }
@Test public void validConfigurationIsValid() { prepareValidConfiguration(); assertValid(validatorToTest.createValidationErrorMessage(configuration)); }
@Test public void whenProduct1HasNoValidIdSet_itsNotValid() { prepareValidConfiguration(); when(productIdValidator.createValidationErrorMessage("productid1")).thenReturn("invalid-reason"); assertNotValid(validatorToTest.createValidationErrorMessage(configuration)); }
@Test public void whenProduct1_has_invalid_path_itsNotValid() { prepareValidConfiguration(); when(pathExecutableValidator.createValidationErrorMessage("path1")).thenReturn("invalid-reason"); assertNotValid(validatorToTest.createValidationErrorMessage(configuration)); }
@Test public void whenProduct2_has_invalid_path_itsNotValid() { prepareValidConfiguration(); when(pathExecutableValidator.createValidationErrorMessage("path2")).thenReturn("invalid-reason"); assertNotValid(validatorToTest.createValidationErrorMessage(configuration)); }
@Test public void when_serverId_is_not_valid__its_not_valid() { prepareValidConfiguration(); when(serverIdValidator.createValidationErrorMessage("server-id")).thenReturn("invalid-reason"); assertNotValid(validatorToTest.createValidationErrorMessage(configuration)); }