RoutingContext { public Map<String,String> toMap() { return context; } private  RoutingContext();  RoutingContext( URI uri ); boolean isDefined(); Map<String,String> toMap(); boolean isServerRoutingEnabled(); @Override String toString(); static final RoutingContext EMPTY; }
@Test void emptyContextInEmptyMap() { assertTrue( RoutingContext.EMPTY.toMap().isEmpty() ); }
@Test void mapRepresentationIsUnmodifiable() { URI uri = URI.create( "neo4j: RoutingContext context = new RoutingContext( uri ); Map<String,String> expectedMap = new HashMap<>(); expectedMap.put( "key1", "value1" ); expectedMap.put( "address", "localhost:7687" ); assertEquals( expectedMap, context.toMap() ); assertThrows( UnsupportedOperationException.class, () -> context.toMap().put( "key2", "value2" ) ); assertEquals( expectedMap, context.toMap() ); }
@Test void populateAddressWithDefaultPort() { URI uri = URI.create( "neo4j: RoutingContext context = new RoutingContext( uri ); assertEquals( singletonMap( "address", "localhost:7687" ), context.toMap() ); }