@@ -3,12 +3,9 @@ package overflowdb.traversal
33import org .scalatest .matchers .should .Matchers ._
44import org .scalatest .wordspec .AnyWordSpec
55import overflowdb ._
6- import overflowdb .traversal .filter .P
76import overflowdb .traversal .testdomains .simple .Thing .Properties .Name
87import overflowdb .traversal .testdomains .simple .{Connection , ExampleGraphSetup , SimpleDomain , Thing , ThingTraversal }
9-
108import scala .collection .mutable
11- import scala .jdk .CollectionConverters ._
129
1310class RepeatTraversalTests extends AnyWordSpec {
1411 import ExampleGraphSetup ._
@@ -68,8 +65,8 @@ class RepeatTraversalTests extends AnyWordSpec {
6865
6966 " emit nodes that meet given condition" in {
7067 val expectedResults = Set (" L1" , " L2" , " L3" )
71- centerTrav.repeat(_.followedBy)(_.emit(_.name.filter(_.startsWith( " L" ) ))).name.toSetMutable shouldBe expectedResults
72- centerTrav.repeat(_.followedBy)(_.emit(_.name.filter(_.startsWith( " L" ) )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
68+ centerTrav.repeat(_.followedBy)(_.emit(_.nameStartsWith( " L" ))).name.toSetMutable shouldBe expectedResults
69+ centerTrav.repeat(_.followedBy)(_.emit(_.nameStartsWith( " L" )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
7370 centerTrav.repeat(_.out)(_.emit(_.has(Name .where(_.startsWith(" L" ))))).property(Name ).toSetMutable shouldBe expectedResults
7471 centerTrav.repeat(_.out)(_.emit(_.has(Name .where(_.startsWith(" L" )))).breadthFirstSearch).property(Name ).toSetMutable shouldBe expectedResults
7572 }
@@ -86,8 +83,8 @@ class RepeatTraversalTests extends AnyWordSpec {
8683 " support arbitrary `until` condition" should {
8784 " work without emit" in {
8885 val expectedResults = Set (" L2" , " R2" )
89- centerTrav.repeat(_.followedBy)(_.until(_.name.filter(_.endsWith( " 2" ) ))).name.toSetMutable shouldBe expectedResults
90- centerTrav.repeat(_.followedBy)(_.until(_.name.filter(_.endsWith( " 2" ) )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
86+ centerTrav.repeat(_.followedBy)(_.until(_.nameEndsWith( " 2" ))).name.toSetMutable shouldBe expectedResults
87+ centerTrav.repeat(_.followedBy)(_.until(_.nameEndsWith( " 2" )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
9188
9289 centerTrav.repeat(_.out)(
9390 _.until(_.has(Name .where(_.matches(" .*2" )))))
@@ -100,16 +97,16 @@ class RepeatTraversalTests extends AnyWordSpec {
10097
10198 " work in combination with emit" in {
10299 val expectedResults = Set (" Center" , " L1" , " L2" , " R1" , " R2" )
103- centerTrav.repeat(_.followedBy)(_.until(_.name.filter(_.endsWith( " 2" ) )).emit).name.toSetMutable shouldBe expectedResults
104- centerTrav.repeat(_.followedBy)(_.until(_.name.filter(_.endsWith( " 2" ) )).emit.breadthFirstSearch).name.toSetMutable shouldBe expectedResults
100+ centerTrav.repeat(_.followedBy)(_.until(_.nameEndsWith( " 2" )).emit).name.toSetMutable shouldBe expectedResults
101+ centerTrav.repeat(_.followedBy)(_.until(_.nameEndsWith( " 2" )).emit.breadthFirstSearch).name.toSetMutable shouldBe expectedResults
105102 centerTrav.repeat(_.out)(_.until(_.has(Name .where(_.matches(" .*2" )))).emit).property(Name ).toSetMutable shouldBe expectedResults
106103 centerTrav.repeat(_.out)(_.until(_.has(Name .where(_.matches(" .*2" )))).emit.breadthFirstSearch).property(Name ).toSetMutable shouldBe expectedResults
107104 }
108105
109106 " result in 'repeat/until' behaviour, i.e. `until` condition is only evaluated after one iteration" in {
110107 val expectedResults = Set (" L1" , " R1" )
111- centerTrav.repeat(_.followedBy)(_.until(_.filter(_. label == Thing .Label ))).name.toSetMutable shouldBe expectedResults
112- centerTrav.repeat(_.followedBy)(_.until(_.filter(_. label == Thing .Label )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
108+ centerTrav.repeat(_.followedBy)(_.until(_.label( Thing .Label ))).name.toSetMutable shouldBe expectedResults
109+ centerTrav.repeat(_.followedBy)(_.until(_.label( Thing .Label )).breadthFirstSearch).name.toSetMutable shouldBe expectedResults
113110 centerTrav.repeat(_.out)(_.until(_.hasLabel(Thing .Label ))).property(Name ).toSetMutable shouldBe expectedResults
114111 centerTrav.repeat(_.out)(_.until(_.hasLabel(Thing .Label )).breadthFirstSearch).property(Name ).toSetMutable shouldBe expectedResults
115112 }
0 commit comments