@@ -150,6 +150,70 @@ public void prettyPrintRelationships() throws Exception {
150150 assertThat (actual , containsString ("| [:RELATIONSHIP_TYPE {prop2: prop2_value, prop1: prop1_value}] |" ));
151151 }
152152
153+ @ Test
154+ public void prettyPrintPath () throws Exception {
155+ // given
156+ BoltResult result = mock (BoltResult .class );
157+ Record record = mock (Record .class );
158+ Value value = mock (Value .class );
159+ Path path = mock (Path .class );
160+
161+
162+ Node n1 = mock (Node .class );
163+ when (n1 .id ()).thenReturn (1L );
164+ when (n1 .labels ()).thenReturn (asList ("L1" ));
165+ when (n1 .asMap (anyObject ())).thenReturn (Collections .emptyMap ());
166+
167+ Relationship r1 = mock (Relationship .class );
168+ when (r1 .startNodeId ()).thenReturn (2L );
169+ when (r1 .type ()).thenReturn ("R1" );
170+ when (r1 .asMap (anyObject ())).thenReturn (Collections .emptyMap ());
171+
172+ Node n2 = mock (Node .class );
173+ when (n2 .id ()).thenReturn (2L );
174+ when (n2 .labels ()).thenReturn (asList ("L2" ));
175+ when (n2 .asMap (anyObject ())).thenReturn (Collections .emptyMap ());
176+
177+ Relationship r2 = mock (Relationship .class );
178+ when (r2 .startNodeId ()).thenReturn (2L );
179+ when (r2 .type ()).thenReturn ("R2" );
180+ when (r2 .asMap (anyObject ())).thenReturn (Collections .emptyMap ());
181+
182+ Node n3 = mock (Node .class );
183+ when (n3 .id ()).thenReturn (3L );
184+ when (n3 .labels ()).thenReturn (asList ("L3" ));
185+ when (n3 .asMap (anyObject ())).thenReturn (Collections .emptyMap ());
186+
187+ Path .Segment s1 = mock (Path .Segment .class );
188+ when (s1 .relationship ()).thenReturn (r1 );
189+ when (s1 .start ()).thenReturn (n1 );
190+ when (s1 .end ()).thenReturn (n2 );
191+
192+ Path .Segment s2 = mock (Path .Segment .class );
193+ when (s2 .relationship ()).thenReturn (r2 );
194+ when (s2 .start ()).thenReturn (n2 );
195+ when (s2 .end ()).thenReturn (n3 );
196+
197+ when (path .start ()).thenReturn (n1 );
198+ when (path .iterator ()).thenAnswer ((i ) -> Arrays .asList (s1 ,s2 ).iterator ());
199+
200+ when (value .type ()).thenReturn (InternalTypeSystem .TYPE_SYSTEM .PATH ());
201+ when (value .asPath ()).thenReturn (path );
202+
203+ when (record .keys ()).thenReturn (asList ("path" ));
204+ when (record .get (eq ("path" ))).thenReturn (value );
205+ when (record .values ()).thenReturn (asList (value ));
206+ when (record .asMap (anyObject ())).thenReturn (Collections .singletonMap ("path" ,value ));
207+ when (result .getRecords ()).thenReturn (asList (record ));
208+ when (result .getSummary ()).thenReturn (mock (ResultSummary .class ));
209+
210+ // when
211+ String actual = verbosePrinter .format (result );
212+
213+ // then
214+ assertThat (actual , containsString ("| (:L1)<-[:R1]-(:L2)-[:R2]->(:L3) |" ));
215+ }
216+
153217 @ Test
154218 public void printRelationshipsAndNodesWithEscapingForSpecialCharacters () throws Exception {
155219 BoltResult result = mock (BoltResult .class );
0 commit comments