package com.tinkerpop.frames;

import java.util.Iterator;

import org.junit.Test;

import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
/**
 * @author Bryn Cooke (http://jglue.org)
 */

public class TestFramedGraph {
    @Test
    public void test() {
        Graph g = new TinkerGraph();
        FramedGraph fg = new FramedGraph(g);

        
        

        Person p1 = fg.addVertex(Person.class);
        p1.setName("Bryn");

        Person p2 = fg.addVertex(Person.class);
        p2.setName("Julia");
        Knows knows = p1.addKnows(p2);
        knows.setYears(15);

        Iterator<Person> frame = fg.V().has("name", "Bryn").frame(Person.class);
        Person p = frame.next();
        
        
        System.out.println(p.getName());
        System.out.println(p.getKnowsCollection().get(0).getYears());



    }
    
    @Test
    public void test2() {
        Graph g = new TinkerGraph();
        FramedGraph fg = new FramedGraph(g, TypeResolver.Java, FrameBuilder.Default);

        Person p1 = fg.addVertex(Programmer.class);
        p1.setName("Bryn");

        Person p2 = fg.addVertex(Person.class);
        p2.setName("Julia");
        Knows knows = p1.addKnows(p2);
        knows.setYears(15);

        Iterator<Person> frame = fg.V().has("name", "Bryn").frame(Person.class);
        Person p = frame.next();
     
        System.out.println(p.getClass().getName());
        

    }
}

@@ -1260,38 +1260,27 @@
         
-Iterator%3CPerson%3E frame
+Person bryn
  = fg.V(
@@ -1293,37 +1293,36 @@
 %22name%22, %22Bryn%22).
-frame
+next
 (Person.class);%0A
@@ -1340,32 +1340,82 @@
 son 
-p = frame.next();%0A
+julia = fg.V().has(%22name%22, %22Julia%22).next(Person.class);%0A   
      %0A
+        %0A
     
@@ -1433,25 +1433,84 @@
 out.println(
-p
+bryn.getClass().getName());%0A        System.out.println(julia
 .getClass().

Add demo of java typing