public void test_reopen01(){
  final IRawStore store=new SimpleMemoryRawStore();
  final BTree btree;
{
    IndexMetadata md=new IndexMetadata(UUID.randomUUID());
    md.setBranchingFactor(3);
    btree=BTree.create(store,md);
  }
  assertTrue(btree.isOpen());
  btree.close();
  assertFalse(btree.isOpen());
  try {
    btree.close();
    fail("Expecting: " + IllegalStateException.class);
  }
 catch (  IllegalStateException ex) {
    if (log.isInfoEnabled())     log.info("Ignoring expected exception: " + ex);
  }
  assertNotNull(btree.getRoot());
  assertTrue(btree.isOpen());
}

public void test_reopen01 ( ) { final IRawStore store = new SimpleMemoryRawStore ( ) ; final BTree btree ; { IndexMetadata md = new IndexMetadata ( UUID . randomUUID ( ) ) ; md . setBranchingFactor ( 3 ) ; btree = BTree . create ( store , md ) ; } assertTrue ( btree . isOpen ( ) ) ; btree . close ( ) ; assertFalse ( btree . isOpen ( ) ) ; try { btree . close ( ) ; fail ( "Expecting: " + IllegalStateException . class ) ; } catch ( IllegalStateException ex ) { if ( log . isInfoEnabled ( ) ) log . info ( "Ignoring expected exception: " + ex ) ; } assertNotNull ( btree . getRoot ( ) ) ; assertTrue ( btree . isOpen ( ) ) ; }
test close on a new tree - should force the root to the store since a new root is dirty ( if empty ) . reopen should then reload the empty root and on life goes .
