FramedGraph { public Transaction tx() { if (delegate instanceof TransactionalGraph) { return new Transaction((TransactionalGraph) delegate); } else { return new Transaction((TransactionalGraph) null); } } FramedGraph(Graph delegate, FrameFactory builder, TypeResolver resolver);  FramedGraph(Graph delegate); Transaction tx(); void close(); T addVertex(Class<T> kind); TVertex addVertex(); VertexTraversal<?, ?, ?> V(); EdgeTraversal<?, ?, ?> E(); VertexTraversal<?, ?, ?> v(final Collection<?> ids); VertexTraversal<?, ?, ?> v(final Object... ids); EdgeTraversal<?, ?, ?> e(final Object... ids); EdgeTraversal<?, ?, ?> e(final Collection<?> ids);  }
@Test public void testTransactionCommitted() { FramedGraph fg = new FramedGraph(transactionalGraph); try(Transaction t = fg.tx()) { t.commit(); } Mockito.verify(transactionalGraph).commit(); }
@Test public void testTransactionRolledBack() { FramedGraph fg = new FramedGraph(transactionalGraph); try(Transaction t = fg.tx()) { t.rollback(); } Mockito.verify(transactionalGraph).rollback(); }
@Test public void testTransactionNotComitted() { FramedGraph fg = new FramedGraph(transactionalGraph); try(Transaction t = fg.tx()) { } Mockito.verify(transactionalGraph).rollback(); }
@Test public void testTransactionException() { FramedGraph fg = new FramedGraph(transactionalGraph); try(Transaction t = fg.tx()) { throw new Exception(); } catch(Exception e) { } Mockito.verify(transactionalGraph).rollback(); }