public void test_delete_markers_visitDeleted(){
  final BTree btree;
{
    IndexMetadata md=new IndexMetadata(UUID.randomUUID());
    md.setDeleteMarkers(true);
    btree=BTree.create(new SimpleMemoryRawStore(),md);
    btree.insert(10,"Bryan");
    btree.insert(20,"Mike");
    btree.insert(30,"James");
  }
  final int flags=IRangeQuery.DEFAULT | IRangeQuery.DELETED;
{
    ITupleCursor2<String> cursor=newCursor(btree,flags,null,null);
    assertEquals(new TestTuple<String>(flags,10,"Bryan",false,0L),cursor.seek(10));
    cursor.remove();
    assertEquals(new TestTuple<String>(flags,10,null,true,0L),cursor.tuple());
    assertTrue(cursor.hasNext());
    assertEquals(new TestTuple<String>(flags,20,"Mike",false,0L),cursor.next());
    assertTrue(cursor.hasPrior());
    assertEquals(new TestTuple<String>(flags,10,null,true,0L),cursor.prior());
  }
}

public void test_delete_markers_visitDeleted ( ) { final BTree btree ; { IndexMetadata md = new IndexMetadata ( UUID . randomUUID ( ) ) ; md . setDeleteMarkers ( true ) ; btree = BTree . create ( new SimpleMemoryRawStore ( ) , md ) ; btree . insert ( 10 , "Bryan" ) ; btree . insert ( 20 , "Mike" ) ; btree . insert ( 30 , "James" ) ; } final int flags = IRangeQuery . DEFAULT | IRangeQuery . DELETED ; { ITupleCursor2 < String > cursor = newCursor ( btree , flags , null , null ) ; assertEquals ( new TestTuple < String > ( flags , 10 , "Bryan" , false , 0L ) , cursor . seek ( 10 ) ) ; cursor . remove ( ) ; assertEquals ( new TestTuple < String > ( flags , 10 , null , true , 0L ) , cursor . tuple ( ) ) ; assertTrue ( cursor . hasNext ( ) ) ; assertEquals ( new TestTuple < String > ( flags , 20 , "Mike" , false , 0L ) , cursor . next ( ) ) ; assertTrue ( cursor . hasPrior ( ) ) ; assertEquals ( new TestTuple < String > ( flags , 10 , null , true , 0L ) , cursor . prior ( ) ) ; } }
test examines the behavior of the cursor when delete markers are enabled and the cursor is willing to visited deleted tuples . since delete markers are enabled remove ( ) will actually be an update that sets the delete marker on the tuple and clears the value associated with that tuple . since deleted tuples are being visited by the cursor , the caller will see the deleted tuples .
