Neo4JDbDecorator implements TestMethodDecorator { @Override public void beforeTest(final TestInvocation invocation) throws Exception { final ExecutionContext context = invocation.getContext(); final Neo4JDbFeatureExecutor dbFeatureExecutor = new Neo4JDbFeatureExecutor(invocation.getFeatureResolver(), context.getDescriptor().getClasses()); final DataSource ds = (DataSource) context.getData(Constants.KEY_DATA_SOURCE); final Connection connection = ds.getConnection(); connection.setAutoCommit(false); context.storeData(Constants.KEY_CONNECTION, connection); dbFeatureExecutor.executeBeforeTest(connection); }  @Override int getPriority(); @Override boolean isConfigurationSupported(final ExecutionContext ctx); @Override void beforeTest(final TestInvocation invocation); @Override void afterTest(final TestInvocation invocation);  }
@Test public void testBeforeTest() throws Exception { decorator.beforeTest(invocation); verify(connection).setAutoCommit(eq(Boolean.FALSE)); verify(executor).executeBeforeTest(eq(connection)); verify(ctx).storeData(eq(Constants.KEY_CONNECTION), eq(connection)); }