@Test public void testBasicValidateAcceptsAValidConfig() { try { config.basicValidate(null); } catch(ConfigException e) { fail("A valid configuration should not throw an exception."); } }
@Override public void basicValidate(final String section) throws ConfigException { for(final CustomApplication app : applications) { if(StringUtils.isEmpty(app.getApplicationName())) { throw new ConfigException(section, "The application name must be a non-empty string, e.g. \"IDOL Admin\"."); } else if(StringUtils.isEmpty(app.getUrl())) { throw new ConfigException(section, "The \"url\" property for \"" + app.getApplicationName() + "\" must not be empty."); } else if (app.getUrl().matches("^\\w+:.*")){ try { new URL(app.getUrl()); } catch(final MalformedURLException e) { throw new ConfigException(section, "The URL provided for \"" + app.getApplicationName() + "\" is malformed. Cause: " + e.getMessage()); } } } }
CustomApplicationsConfig extends AbstractConfig<CustomApplicationsConfig> { @Override public void basicValidate(final String section) throws ConfigException { for(final CustomApplication app : applications) { if(StringUtils.isEmpty(app.getApplicationName())) { throw new ConfigException(section, "The application name must be a non-empty string, e.g. \"IDOL Admin\"."); } else if(StringUtils.isEmpty(app.getUrl())) { throw new ConfigException(section, "The \"url\" property for \"" + app.getApplicationName() + "\" must not be empty."); } else if (app.getUrl().matches("^\\w+:.*")){ try { new URL(app.getUrl()); } catch(final MalformedURLException e) { throw new ConfigException(section, "The URL provided for \"" + app.getApplicationName() + "\" is malformed. Cause: " + e.getMessage()); } } } } }
CustomApplicationsConfig extends AbstractConfig<CustomApplicationsConfig> { @Override public void basicValidate(final String section) throws ConfigException { for(final CustomApplication app : applications) { if(StringUtils.isEmpty(app.getApplicationName())) { throw new ConfigException(section, "The application name must be a non-empty string, e.g. \"IDOL Admin\"."); } else if(StringUtils.isEmpty(app.getUrl())) { throw new ConfigException(section, "The \"url\" property for \"" + app.getApplicationName() + "\" must not be empty."); } else if (app.getUrl().matches("^\\w+:.*")){ try { new URL(app.getUrl()); } catch(final MalformedURLException e) { throw new ConfigException(section, "The URL provided for \"" + app.getApplicationName() + "\" is malformed. Cause: " + e.getMessage()); } } } }  }
CustomApplicationsConfig extends AbstractConfig<CustomApplicationsConfig> { @Override public void basicValidate(final String section) throws ConfigException { for(final CustomApplication app : applications) { if(StringUtils.isEmpty(app.getApplicationName())) { throw new ConfigException(section, "The application name must be a non-empty string, e.g. \"IDOL Admin\"."); } else if(StringUtils.isEmpty(app.getUrl())) { throw new ConfigException(section, "The \"url\" property for \"" + app.getApplicationName() + "\" must not be empty."); } else if (app.getUrl().matches("^\\w+:.*")){ try { new URL(app.getUrl()); } catch(final MalformedURLException e) { throw new ConfigException(section, "The URL provided for \"" + app.getApplicationName() + "\" is malformed. Cause: " + e.getMessage()); } } } }  @Override CustomApplicationsConfig merge(final CustomApplicationsConfig other); @Override void basicValidate(final String section); }
CustomApplicationsConfig extends AbstractConfig<CustomApplicationsConfig> { @Override public void basicValidate(final String section) throws ConfigException { for(final CustomApplication app : applications) { if(StringUtils.isEmpty(app.getApplicationName())) { throw new ConfigException(section, "The application name must be a non-empty string, e.g. \"IDOL Admin\"."); } else if(StringUtils.isEmpty(app.getUrl())) { throw new ConfigException(section, "The \"url\" property for \"" + app.getApplicationName() + "\" must not be empty."); } else if (app.getUrl().matches("^\\w+:.*")){ try { new URL(app.getUrl()); } catch(final MalformedURLException e) { throw new ConfigException(section, "The URL provided for \"" + app.getApplicationName() + "\" is malformed. Cause: " + e.getMessage()); } } } }  @Override CustomApplicationsConfig merge(final CustomApplicationsConfig other); @Override void basicValidate(final String section);  }