ControlPointServerConfig extends SimpleComponent<ControlPointServerConfig> implements PasswordsConfig<ControlPointServerConfig> { @Override public void basicValidate(final String component) throws ConfigException { if (protocol == null) failValidate(component, "protocol must be specified"); if (!Arrays.asList("http", "https").contains(protocol.toLowerCase())) { failValidate(component, "protocol must be HTTP or HTTPS"); } if (host == null) failValidate(component, "host must be specified"); if (StringUtils.isBlank(host)) failValidate(component, "host must not be blank"); if (port == null) failValidate(component, "port must be specified"); if (port <= 0 || port > 65535) failValidate(component, "port must be between 1 and 65535"); if (credentials != null) credentials.basicValidate(component); }  @Override void basicValidate(final String component); @Override ControlPointServerConfig withoutPasswords(); @Override ControlPointServerConfig withEncryptedPasswords(final TextEncryptor encryptor); @Override ControlPointServerConfig withDecryptedPasswords(final TextEncryptor encryptor); ControlPointServerDetails toServerDetails();  }
@Test public void testBasicValidate_valid() throws ConfigException { validConfig.basicValidate("cp"); }
@Test(expected = ConfigException.class) public void testBasicValidate_missingProtocol() throws ConfigException { validConfig.toBuilder().protocol(null).build().basicValidate("cp"); }
@Test(expected = ConfigException.class) public void testBasicValidate_unknownProtocol() throws ConfigException { validConfig.toBuilder().protocol("FTP").build().basicValidate("cp"); }
@Test public void testBasicValidate_lowercaseProtocol() throws ConfigException { validConfig.toBuilder().protocol("https").build().basicValidate("cp"); }
@Test(expected = ConfigException.class) public void testBasicValidate_missingHost() throws ConfigException { validConfig.toBuilder().host(null).build().basicValidate("cp"); }
@Test(expected = ConfigException.class) public void testBasicValidate_missingPort() throws ConfigException { validConfig.toBuilder().port(null).build().basicValidate("cp"); }
@Test public void testBasicValidate_missingCredentials() throws ConfigException { validConfig.toBuilder().credentials(null).build().basicValidate("cp"); }
@Test public void testBasicValidate_missingbasePath() throws ConfigException { validConfig.toBuilder().basePath(null).build().basicValidate("cp"); }