RoutingTableRegistryImpl implements RoutingTableRegistry { @Override public Set<BoltServerAddress> allServers() { Set<BoltServerAddress> servers = new HashSet<>(); for ( RoutingTableHandler tableHandler : routingTableHandlers.values() ) { servers.addAll( tableHandler.servers() ); } return servers; } RoutingTableRegistryImpl( ConnectionPool connectionPool, Rediscovery rediscovery, Clock clock, Logger logger, long routingTablePurgeDelayMs );   RoutingTableRegistryImpl( ConcurrentMap<DatabaseName,RoutingTableHandler> routingTableHandlers, RoutingTableHandlerFactory factory, Logger logger ); @Override CompletionStage<RoutingTableHandler> ensureRoutingTable( ConnectionContext context ); @Override Set<BoltServerAddress> allServers(); @Override void remove( DatabaseName databaseName ); @Override void removeAged(); boolean contains( DatabaseName databaseName );  }
@Test void shouldReturnServersInAllRoutingTables() throws Throwable { ConcurrentMap<DatabaseName,RoutingTableHandler> map = new ConcurrentHashMap<>(); map.put( database( "Apple" ), mockedRoutingTableHandler( A, B, C ) ); map.put( database( "Banana" ), mockedRoutingTableHandler( B, C, D ) ); map.put( database( "Orange" ), mockedRoutingTableHandler( E, F, C ) ); RoutingTableHandlerFactory factory = mockedHandlerFactory(); RoutingTableRegistryImpl routingTables = new RoutingTableRegistryImpl( map, factory, DEV_NULL_LOGGER ); Set<BoltServerAddress> servers = routingTables.allServers(); assertThat( servers, containsInAnyOrder( A, B, C, D, E, F ) ); }