@Test
void shouldReleaseConnectionWhenBeginFails()
{

    RuntimeException error = new RuntimeException( "Wrong bookmark!" );
    Connection connection = connectionWithBegin( handler -> handler.onFailure( error ) );
    UnmanagedTransaction tx = new UnmanagedTransaction( connection, new DefaultBookmarkHolder(), UNLIMITED_FETCH_SIZE );
    Bookmark bookmark = InternalBookmark.parse( "SomeBookmark" );
    TransactionConfig txConfig = TransactionConfig.empty();
    RuntimeException e = assertThrows( RuntimeException.class, () -> await( tx.beginAsync( bookmark, txConfig ) ) );
    assertEquals( error, e );
    verify( connection ).release();
}