package com.tinkerpop.pipes;

import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.Vertex;
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerEdge;
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory;
import com.tinkerpop.blueprints.pgm.impls.tg.TinkerVertex;
import com.tinkerpop.pipes.pgm.EdgeVertexPipe;
import com.tinkerpop.pipes.pgm.PropertyPipe;
import com.tinkerpop.pipes.pgm.VertexEdgePipe;

import java.util.Arrays;
import java.util.List;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class PathSequenceTest extends BaseTest {

    public void testPathSequencing() {
        Graph graph = TinkerGraphFactory.createTinkerGraph();
        Vertex marko = graph.getVertex("1");
        Pipe pipe1 = new VertexEdgePipe(VertexEdgePipe.Step.OUT_EDGES);
        Pipe pipe2 = new EdgeVertexPipe(EdgeVertexPipe.Step.IN_VERTEX);
        Pipe pipe3 = new PropertyPipe<Vertex, String>("name");
        Pipe<Vertex, String> pipeline = new Pipeline<Vertex, String>(Arrays.asList(pipe1, pipe2, pipe3));
        pipeline.setStarts(Arrays.asList(marko).iterator());
        PathSequence paths = new PathSequence(pipeline);

        for (List path : paths) {
            String name = (String) path.get(path.size() - 1);
            assertEquals(path.get(0), marko);
            assertEquals(path.get(1).getClass(), TinkerEdge.class);
            assertEquals(path.get(2).getClass(), TinkerVertex.class);
            assertEquals(path.get(3).getClass(), String.class);
            if (name.equals("vadas")) {
                assertEquals(path.get(1), graph.getEdge(7));
                assertEquals(path.get(2), graph.getVertex(2));
                assertEquals(path.get(3), "vadas");
            } else if (name.equals("lop")) {
                assertEquals(path.get(1), graph.getEdge(9));
                assertEquals(path.get(2), graph.getVertex(3));
                assertEquals(path.get(3), "lop");
            } else if (name.equals("josh")) {
                assertEquals(path.get(1), graph.getEdge(8));
                assertEquals(path.get(2), graph.getVertex(4));
                assertEquals(path.get(3), "josh");
            } else {
                assertFalse(true);
            }
            //System.out.println(path);
        }
    }
}

@@ -605,148 +605,66 @@
    p
-ublic void testPathSequencing() %7B%0A        Graph graph = TinkerGraphFactory.createTinkerGraph();%0A        Vertex marko = graph.getVertex(%221%22);
+rivate Pipe%3CVertex, String%3E outE_inV_Name(Vertex vertex) %7B
 %0A   
@@ -1018,25 +1018,204 @@
 ist(
-marko).iterator()
+vertex).iterator());%0A        return pipeline;%0A    %7D%0A%0A    public void testPathSequencing() %7B%0A        Graph graph = TinkerGraphFactory.createTinkerGraph();%0A        Vertex marko = graph.getVertex(%221%22
 );%0A 
@@ -1259,24 +1259,36 @@
 equence(
-pipeline
+outE_inV_Name(marko)
 );%0A%0A    

Refactor test.