State s0 = new State(options);
State s1 = e1.traverse(s0);
State s2 = e2.traverse(s1);
State s3 = e3.traverse(s2);
Edge partialE2First = intermediate.getIncoming().iterator().next();
Edge partialE2Second = intermediate.getOutgoing().iterator().next();
System.out.println(intermediate.getIncoming());
System.out.println(intermediate.getOutgoing());
State partialS0 = new State(options);
State partialS1 = e1.traverse(partialS0);
State partialS2A = partialE2First.traverse(partialS1);
State partialS2B = partialE2Second.traverse(partialS2A);
State partialS3 = e3.traverse(partialS2B);
// Should start at the same time.
assertEquals(s0.getTimeSeconds(), partialS0.getTimeSeconds());
// Time and cost should be the same up to a rounding difference.
assertTrue(Math.abs(s3.getTimeSeconds() - partialS3.getTimeSeconds()) <= 1);
assertTrue(Math.abs(s3.getElapsedTimeSeconds() - partialS3.getElapsedTimeSeconds()) <= 1);
assertTrue(Math.abs(s3.getWeight() - partialS3.getWeight()) <= 1);
// All intersections take 0 seconds now.
options.traversalCostModel = (new DummyCostModel(0.0));
State s0NoCost = new State(options);
State s1NoCost = e1.traverse(s0NoCost);
State s2NoCost = e2.traverse(s1NoCost);
State s3NoCost = e3.traverse(s2NoCost);
State partialS0NoCost = new State(options);
State partialS1NoCost = e1.traverse(partialS0NoCost);
State partialS2ANoCost = partialE2First.traverse(partialS1NoCost);
State partialS2BNoCost = partialE2Second.traverse(partialS2ANoCost);
State partialS3NoCost = e3.traverse(partialS2BNoCost);
// Time and cost should be the same up to a rounding difference.
assertTrue(Math.abs(s3NoCost.getTimeSeconds() - partialS3NoCost.getTimeSeconds()) <= 1);
assertTrue(Math.abs(s3NoCost.getElapsedTimeSeconds() - partialS3NoCost.getElapsedTimeSeconds()) <= 1);