@Test public void validConfigurationIsValid() { prepareValidConfiguration(); assertValid(validatorToTest.createValidationErrorMessage(configuration)); }
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; }
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; } }
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; }  }
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); }
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);  }