// Path: src/main/java/co/indexia/antiquity/graph/VersionContextGraph.java
// public static <V extends Comparable<V>> VersionContextGraph<V> vc(HistoricVersionedGraph<?, V> graph, V version) {
//     return new VersionContextGraph<V>(graph, version);
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasAmount.java
// @Factory
// public static <T> Matcher<T> hasAmount(int expected) {
//     return new HasAmount(expected);
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasElementIds.java
// @Factory
// public static <T> Matcher<T> elementIds(TYPE type, Object... expected) {
//     return new HasElementIds(type, expected);
// }
// 
// Path: src/main/java/co/indexia/antiquity/graph/identifierBehavior/LongGraphIdentifierBehavior.java
// public class LongGraphIdentifierBehavior extends BaseGraphIdentifierBehavior<Long> {
//     @Override
//     public Long getMinPossibleGraphVersion() {
//         return (long) 1;
//     }
// 
//     @Override
//     public Long getMaxPossibleGraphVersion() {
//         return Long.MAX_VALUE;
//     }
// 
//     @Override
//     public Long getLatestGraphVersion() {
//         Long lastVer =
//                 (Long) getGraph().getRootVertex(VEProps.GRAPH_TYPE.HISTORIC).getProperty(
//                         VEProps.LATEST_GRAPH_VERSION_PROP_KEY);
//         if (lastVer == null) {
//             return 0L;
//         } else {
//             return lastVer;
//         }
//     }
// 
//     @Override
//     public Long getNextGraphVersion(Long currentVersion) {
//         if (currentVersion == Long.MAX_VALUE)
//             throw new IllegalStateException("Cannot get next version, long range has ended ");
// 
//         return currentVersion + 1;
//     }
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasElementIds.java
// public class HasElementIds<T extends Iterable<? extends Element>> extends TypeSafeMatcher<T> {
//     private final TYPE type;
//     private final ID id;
//     private final List<Object> expected;
//     private List<Object> ids = new ArrayList<Object>();
// 
//     public enum TYPE {
//         CONTAINS, EXACTLY_MATCHES
//     };
// 
//     public enum ID {
//         ID, HARD_ID
//     }
// 
//     protected HasElementIds(TYPE type, Object... expected) {
//         this(ID.ID, type, expected);
//     }
// 
//     protected HasElementIds(ID id, TYPE type, Object... expected) {
//         this.type = type;
//         this.id = id;
//         this.expected = Lists.newArrayList(expected);
//     }
// 
//     @Override
//     protected boolean matchesSafely(T t) {
//         for (Element e : t) {
//             if (id == ID.ID) {
//                 ids.add(e.getId());
//             } else {
//                 if (!(e instanceof HistoricVersionedElement)) {
//                     throw new IllegalStateException("HARD_ID must be used with historic elements only");
//                 } else {
//                     HistoricVersionedElement he = (HistoricVersionedElement)e;
//                     ids.add(((HistoricVersionedElement) e).getHardId());
//                 }
//             }
//         }
// 
//         if (type == TYPE.CONTAINS) {
//             return ids.containsAll(expected);
//         } else if (type == TYPE.EXACTLY_MATCHES) {
//             return (ids.containsAll(expected) && expected.containsAll(ids));
//         }
// 
//         throw new IllegalStateException(("comparison type is unsupported."));
//     }
// 
//     @Override
//     public void describeTo(Description description) {
//         description.appendText(expected.toString());
//     }
// 
//     @Override
//     protected void describeMismatchSafely(T item, org.hamcrest.Description mismatchDescription) {
//         mismatchDescription.appendText(ids.toString());
//     }
// 
//     @Factory
//     public static <T> Matcher<T> elementIds(TYPE type, Object... expected) {
//         return new HasElementIds(type, expected);
//     }
// 
//     @Factory
//     public static <T> Matcher<T> elementIds(ID id, TYPE type, Object... expected) {
//         return new HasElementIds(id, type, expected);
//     }
// }


import co.indexia.antiquity.graph.matchers.HasElementIds;
import org.junit.BeforeClass;
import org.junit.Test;
import org.neo4j.test.ImpermanentGraphDatabase;
import static co.indexia.antiquity.graph.VersionContextGraph.vc;
import static co.indexia.antiquity.graph.matchers.HasAmount.hasAmount;
import static co.indexia.antiquity.graph.matchers.HasElementIds.elementIds;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph;
import co.indexia.antiquity.graph.identifierBehavior.LongGraphIdentifierBehavior;
        vc3 = vc(h, ver3);
        assertThat(vc3, notNullValue());
    }

    @Test
    public void contextCreationTest() {
        Long v104 = 104L;
        VersionContextGraph<Long> vc = vc(graph.getHistoricGraph(), v104);
        assertThat(vc, notNullValue());
        assertThat(v104, is(vc.getVersion()));

        assertThat(vc1.getVersion(), is(ver1));
        assertThat(vc2.getVersion(), is(ver2));
    }

    @Test
    public void getVertexByIdTest() {
        VersionContextGraph<Long> vc = vc(h, ver1);
        VersionContextGraph<Long> vc2 = vc(h, ver2);

        assertThat((String) vc.getVertex(vertex1Id).getProperty("fooKey1"), is("foo1"));
        assertThat((String) vc2.getVertex(vertex1Id).getProperty("fooKey1"), is("foo1New"));

        assertThat(vc1.getVertex(vertex1Id), instanceOf(HistoricVersionedVertex.class));
        assertThat(vc1.getVertex(vertex2Id), nullValue());
        assertThat(vc2.getVertex(vertex1Id).getId(), is(vertex1.getId()));
    }

    @Test
    public void gettingAllVerticesTest() {
// Path: src/main/java/co/indexia/antiquity/graph/VersionContextGraph.java
// public static <V extends Comparable<V>> VersionContextGraph<V> vc(HistoricVersionedGraph<?, V> graph, V version) {
//     return new VersionContextGraph<V>(graph, version);
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasAmount.java
// @Factory
// public static <T> Matcher<T> hasAmount(int expected) {
//     return new HasAmount(expected);
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasElementIds.java
// @Factory
// public static <T> Matcher<T> elementIds(TYPE type, Object... expected) {
//     return new HasElementIds(type, expected);
// }
// 
// Path: src/main/java/co/indexia/antiquity/graph/identifierBehavior/LongGraphIdentifierBehavior.java
// public class LongGraphIdentifierBehavior extends BaseGraphIdentifierBehavior<Long> {
//     @Override
//     public Long getMinPossibleGraphVersion() {
//         return (long) 1;
//     }
// 
//     @Override
//     public Long getMaxPossibleGraphVersion() {
//         return Long.MAX_VALUE;
//     }
// 
//     @Override
//     public Long getLatestGraphVersion() {
//         Long lastVer =
//                 (Long) getGraph().getRootVertex(VEProps.GRAPH_TYPE.HISTORIC).getProperty(
//                         VEProps.LATEST_GRAPH_VERSION_PROP_KEY);
//         if (lastVer == null) {
//             return 0L;
//         } else {
//             return lastVer;
//         }
//     }
// 
//     @Override
//     public Long getNextGraphVersion(Long currentVersion) {
//         if (currentVersion == Long.MAX_VALUE)
//             throw new IllegalStateException("Cannot get next version, long range has ended ");
// 
//         return currentVersion + 1;
//     }
// }
// 
// Path: src/test/java/co/indexia/antiquity/graph/matchers/HasElementIds.java
// public class HasElementIds<T extends Iterable<? extends Element>> extends TypeSafeMatcher<T> {
//     private final TYPE type;
//     private final ID id;
//     private final List<Object> expected;
//     private List<Object> ids = new ArrayList<Object>();
// 
//     public enum TYPE {
//         CONTAINS, EXACTLY_MATCHES
//     };
// 
//     public enum ID {
//         ID, HARD_ID
//     }
// 
//     protected HasElementIds(TYPE type, Object... expected) {
//         this(ID.ID, type, expected);
//     }
// 
//     protected HasElementIds(ID id, TYPE type, Object... expected) {
//         this.type = type;
//         this.id = id;
//         this.expected = Lists.newArrayList(expected);
//     }
// 
//     @Override
//     protected boolean matchesSafely(T t) {
//         for (Element e : t) {
//             if (id == ID.ID) {
//                 ids.add(e.getId());
//             } else {
//                 if (!(e instanceof HistoricVersionedElement)) {
//                     throw new IllegalStateException("HARD_ID must be used with historic elements only");
//                 } else {
//                     HistoricVersionedElement he = (HistoricVersionedElement)e;
//                     ids.add(((HistoricVersionedElement) e).getHardId());
//                 }
//             }
//         }
// 
//         if (type == TYPE.CONTAINS) {
//             return ids.containsAll(expected);
//         } else if (type == TYPE.EXACTLY_MATCHES) {
//             return (ids.containsAll(expected) && expected.containsAll(ids));
//         }
// 
//         throw new IllegalStateException(("comparison type is unsupported."));
//     }
// 
//     @Override
//     public void describeTo(Description description) {
//         description.appendText(expected.toString());
//     }
// 
//     @Override
//     protected void describeMismatchSafely(T item, org.hamcrest.Description mismatchDescription) {
//         mismatchDescription.appendText(ids.toString());
//     }
// 
//     @Factory
//     public static <T> Matcher<T> elementIds(TYPE type, Object... expected) {
//         return new HasElementIds(type, expected);
//     }
// 
//     @Factory
//     public static <T> Matcher<T> elementIds(ID id, TYPE type, Object... expected) {
//         return new HasElementIds(id, type, expected);
//     }
// }


// Path: src/test/java/co/indexia/antiquity/graph/VersionContextGraphTest.java
import co.indexia.antiquity.graph.matchers.HasElementIds;
import org.junit.BeforeClass;
import org.junit.Test;
import org.neo4j.test.ImpermanentGraphDatabase;
import static co.indexia.antiquity.graph.VersionContextGraph.vc;
import static co.indexia.antiquity.graph.matchers.HasAmount.hasAmount;
import static co.indexia.antiquity.graph.matchers.HasElementIds.elementIds;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph;
import co.indexia.antiquity.graph.identifierBehavior.LongGraphIdentifierBehavior;

        vc3 = vc(h, ver3);
        assertThat(vc3, notNullValue());
    }

    @Test
    public void contextCreationTest() {
        Long v104 = 104L;
        VersionContextGraph<Long> vc = vc(graph.getHistoricGraph(), v104);
        assertThat(vc, notNullValue());
        assertThat(v104, is(vc.getVersion()));

        assertThat(vc1.getVersion(), is(ver1));
        assertThat(vc2.getVersion(), is(ver2));
    }

    @Test
    public void getVertexByIdTest() {
        VersionContextGraph<Long> vc = vc(h, ver1);
        VersionContextGraph<Long> vc2 = vc(h, ver2);

        assertThat((String) vc.getVertex(vertex1Id).getProperty("fooKey1"), is("foo1"));
        assertThat((String) vc2.getVertex(vertex1Id).getProperty("fooKey1"), is("foo1New"));

        assertThat(vc1.getVertex(vertex1Id), instanceOf(HistoricVersionedVertex.class));
        assertThat(vc1.getVertex(vertex2Id), nullValue());
        assertThat(vc2.getVertex(vertex1Id).getId(), is(vertex1.getId()));
    }

    @Test
    public void gettingAllVerticesTest() {
        assertThat(vc1.getVertices(), elementIds(HasElementIds.ID.ID, HasElementIds.TYPE.EXACTLY_MATCHES, vertex1Id));