ElasticsearchConnectionManager implements ElasticsearchClientResolver, ElasticsearchConfigurationObserver { public void removeElasticsearchConnection(String connectionId) { if (connectionId == null) { return; } ElasticsearchConnection elasticsearchConnection = _elasticsearchConnections.get(connectionId); if (elasticsearchConnection == null) { return; } elasticsearchConnection.close(); _elasticsearchConnections.remove(connectionId); }  void addElasticsearchConnection(
		ElasticsearchConnection elasticsearchConnection); @Override int compareTo(
		ElasticsearchConfigurationObserver elasticsearchConfigurationObserver); ElasticsearchConnection getElasticsearchConnection(); ElasticsearchConnection getElasticsearchConnection(
		boolean preferLocalCluster); ElasticsearchConnection getElasticsearchConnection(
		String connectionId); String getLocalClusterConnectionId(); @Override int getPriority(); @Override RestHighLevelClient getRestHighLevelClient(); @Override RestHighLevelClient getRestHighLevelClient(String connectionId); @Override RestHighLevelClient getRestHighLevelClient(
		String connectionId, boolean preferLocalCluster); boolean isCrossClusterReplicationEnabled(); @Override void onElasticsearchConfigurationUpdate(); void removeElasticsearchConnection(String connectionId);  }
@Test public void testRemoveConnectionThatDoesNotExistWithConnectionId() { ElasticsearchConnection elasticsearchConnection = Mockito.mock( ElasticsearchConnection.class); Mockito.when( elasticsearchConnection.getConnectionId() ).thenReturn( "test" ); _elasticsearchConnectionManager.removeElasticsearchConnection( elasticsearchConnection.getConnectionId()); Mockito.verify( elasticsearchConnection, Mockito.never() ).close(); }
@Test public void testRemoveConnectionThatExistsWithConnectionId() { _elasticsearchConnectionManager.removeElasticsearchConnection( _remoteElasticsearchConnection1.getConnectionId()); Mockito.verify( _remoteElasticsearchConnection1 ).close(); }
@Test public void testRemoveConnectionWithNullConnectionId() { _elasticsearchConnectionManager.removeElasticsearchConnection(null); }