CommitTxResponseHandler implements ResponseHandler { @Override public void onSuccess( Map<String,Value> metadata ) { Value bookmarkValue = metadata.get( "bookmark" ); if ( bookmarkValue == null ) { commitFuture.complete( null ); } else { commitFuture.complete( InternalBookmark.parse( bookmarkValue.asString() ) ); } } CommitTxResponseHandler( CompletableFuture<Bookmark> commitFuture ); @Override void onSuccess( Map<String,Value> metadata ); @Override void onFailure( Throwable error ); @Override void onRecord( Value[] fields );  }
@Test void shouldHandleSuccessWithoutBookmark() { handler.onSuccess( emptyMap() ); assertNull( await( future ) ); }
@Test void shouldHandleSuccessWithBookmark() { String bookmarkString = "neo4j:bookmark:v1:tx12345"; handler.onSuccess( singletonMap( "bookmark", value( bookmarkString ) ) ); assertEquals( InternalBookmark.parse( bookmarkString ), await( future ) ); }