### Question:
BoltConnectorValidator 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]; 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 "tls_level": setting = (BaseSetting) setting( settingName, optionsObeyCase( BoltConnector.EncryptionLevel.class ), OPTIONAL.name() ); setting.setDescription( "Encryption level to require this connector to use." ); break; case "address": setting = listenAddress( settingName, 7687 ); 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, 7687 ); setting.setDescription( "Address the connector should bind to." ); break; case "advertised_address": setting = advertisedAddress( settingName, listenAddress( settingName, 7687 ) ); setting.setDescription( "Advertised address for this connector." ); break; case "thread_pool_min_size": setting = (BaseSetting) setting( settingName, INTEGER, NO_DEFAULT ); setting.setDescription( "The number of threads to keep in the thread pool bound to this connector, even if they are idle." ); break; case "thread_pool_max_size": setting = (BaseSetting) setting( settingName, INTEGER, NO_DEFAULT ); setting.setDescription( "The maximum number of threads allowed in the thread pool bound to this connector." ); break; case "thread_pool_keep_alive": setting = (BaseSetting) setting( settingName, DURATION, NO_DEFAULT ); setting.setDescription( "The maximum time an idle thread in the thread pool bound to this connector will wait for new tasks." ); break; case "unsupported_thread_pool_queue_size": setting = (BaseSetting) setting( settingName, INTEGER, NO_DEFAULT ); setting.setDescription( "The queue size of the thread pool bound to this connector (-1 for unbounded, 0 for direct handoff, > 0 for bounded)" ); break; default: return Optional.empty(); } if ( isDeprecatedConnectorName( name ) && !setting.deprecated() ) { setting.setDeprecated( true ); setting.setReplacement( format( "%s.%s.%s.%s", parts[0], parts[1], "bolt", subsetting ) ); } return Optional.of( setting ); } BoltConnectorValidator();   }### Answer:
@Test public void setsDeprecationFlagOnAddress() { Setting setting = cv.getSettingFor( "dbms.connector.bolt.address", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.of( "dbms.connector.bolt.listen_address" ), setting.replacement() ); }
@Test public void setsDeprecationFlagOnType() { Setting setting = cv.getSettingFor( "dbms.connector.bolt.type", Collections.emptyMap() ) .orElseThrow( () -> new RuntimeException( "missing setting!" ) ); assertTrue( setting.deprecated() ); assertEquals( Optional.empty(), setting.replacement() ); }