### Question:
HttpConnectorValidator extends ConnectorValidator { @Override @Nonnull protected Optional<Setting<Object>> getSettingFor( @Nonnull String settingName, @Nonnull Map<String,String> params ) { String[] parts = settingName.split( "\\." ); final String name = parts[2]; final String subsetting = parts[3]; final boolean encrypted = encryptionSetting( name ).apply( params::get ) == Encryption.TLS; BaseSetting setting; switch ( subsetting ) { case "enabled": setting = (BaseSetting) setting( settingName, BOOLEAN, "false" ); setting.setDescription( "Enable this connector." ); break; case "type": setting = (BaseSetting) setting( settingName, optionsObeyCase( Connector.ConnectorType.class ), NO_DEFAULT ); setting.setDeprecated( true ); setting.setDescription( "Connector type. This setting is deprecated and its value will instead be " + "inferred from the name of the connector." ); break; case "encryption": setting = encryptionSetting( name ); setting.setDescription( "Enable TLS for this connector." ); break; case "address": setting = listenAddress( settingName, defaultPort( name, params ) ); setting.setDeprecated( true ); setting.setReplacement( "dbms.connector." + name + ".listen_address" ); setting.setDescription( "Address the connector should bind to. Deprecated and replaced by " + setting.replacement().get() + "." ); break; case "listen_address": setting = listenAddress( settingName, defaultPort( name, params ) ); setting.setDescription( "Address the connector should bind to." ); break; case "advertised_address": setting = advertisedAddress( settingName, listenAddress( settingName, defaultPort( name, params ) ) ); setting.setDescription( "Advertised address for this connector." ); break; default: return Optional.empty(); } if ( isDeprecatedConnectorName( name ) && !setting.deprecated() ) { setting.setDeprecated( true ); setting.setReplacement( format( "%s.%s.%s.%s", parts[0], parts[1], encrypted ? "https" : "http", subsetting) ); } return Optional.of( setting ); } HttpConnectorValidator(); @Nonnull static BaseSetting<HttpConnector.Encryption> encryptionSetting( @Nonnull String name ); @Nonnull static BaseSetting<HttpConnector.Encryption> encryptionSetting( @Nonnull String name, Encryption
            defaultValue );  }### Answer:
@Test public void setsDeprecationFlagOnAddress() { Setting setting = cv.getSettingFor( "dbms.connector.http.address", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.of( "dbms.connector.http.listen_address" ), setting.replacement() ); }
@Test public void setsDeprecationFlagOnEncryption() { Setting setting = cv.getSettingFor( "dbms.connector.http.encryption", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.empty(), setting.replacement() ); }
@Test public void sdfa() { Setting setting = cv.getSettingFor( "dbms.connector.http.type", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.empty(), setting.replacement() ); }
@Test public void setsDeprecationFlagOnType() { Setting setting = cv.getSettingFor( "dbms.connector.http.type", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.empty(), setting.replacement() ); }