### Question:
RelationshipExpanderBuilder { @SuppressWarnings( "unchecked" ) public static PathExpander describeRelationships( Map<String, Object> description ) { PathExpanderBuilder expander = PathExpanderBuilder.allTypesAndDirections(); Object relationshipsDescription = description.get( "relationships" ); if ( relationshipsDescription != null ) { Collection<Object> pairDescriptions; if ( relationshipsDescription instanceof Collection ) { pairDescriptions = (Collection<Object>) relationshipsDescription; } else { pairDescriptions = Arrays.asList( relationshipsDescription ); } for ( Object pairDescription : pairDescriptions ) { Map map = (Map) pairDescription; String name = (String) map.get( "type" ); RelationshipType type = RelationshipType.withName( name ); String directionName = (String) map.get( "direction" ); expander = ( directionName == null ) ? expander.add( type ) : expander.add( type, stringToEnum( directionName, RelationshipDirection.class, true ).internal ); } } return expander.build(); } private  RelationshipExpanderBuilder(); @SuppressWarnings( "unchecked" ) static PathExpander describeRelationships( Map<String, Object> description );  }### Answer:
@Test public void shouldInterpretNoSpecifiedRelationshipsAsAll() { Node node = createSomeData(); PathExpander expander = RelationshipExpanderBuilder.describeRelationships( map() ); Set<Relationship> expanded; try ( Transaction tx = db.beginTx() ) { expanded = asSet( expander.expand( singleNodePath( node ), NO_STATE ) ); tx.success(); } try ( Transaction tx = db.beginTx() ) { assertEquals( asSet( node.getRelationships() ), expanded ); tx.success(); } }
@Test public void shouldInterpretSomeSpecifiedRelationships() { Node node = createSomeData(); PathExpander expander = RelationshipExpanderBuilder.describeRelationships( map( "relationships", map( "type", MyRelTypes.TEST.name(), "direction", RelationshipDirection.out.name() ) ) ); Set<Relationship> expanded; try ( Transaction tx = db.beginTx() ) { expanded = asSet( expander.expand( singleNodePath( node ), NO_STATE ) ); tx.success(); } try ( Transaction tx = db.beginTx() ) { assertEquals( asSet( node.getRelationships( MyRelTypes.TEST ) ), expanded ); tx.success(); } }