public void test_readImmutable(){
  final IRawStore store=getStore();
  try {
    final int len=100;
    final byte[] expected1=new byte[len];
    r.nextBytes(expected1);
    final ByteBuffer tmp=ByteBuffer.wrap(expected1);
    final long addr1=store.write(tmp);
    assertEquals(len,tmp.position());
    assertEquals(tmp.position(),tmp.limit());
    final ByteBuffer actual=store.read(addr1);
    assertEquals(expected1,actual);
    if (!actual.isReadOnly()) {
      final byte[] tmp2=new byte[100];
      r.nextBytes(tmp2);
      actual.clear();
      actual.put(tmp2);
      actual.flip();
      assertEquals(expected1,store.read(addr1));
    }
  }
  finally {
    store.destroy();
  }
}

public void test_readImmutable ( ) { final IRawStore store = getStore ( ) ; try { final int len = 100 ; final byte [ ] expected1 = new byte [ len ] ; r . nextBytes ( expected1 ) ; final ByteBuffer tmp = ByteBuffer . wrap ( expected1 ) ; final long addr1 = store . write ( tmp ) ; assertEquals ( len , tmp . position ( ) ) ; assertEquals ( tmp . position ( ) , tmp . limit ( ) ) ; final ByteBuffer actual = store . read ( addr1 ) ; assertEquals ( expected1 , actual ) ; if ( ! actual . isReadOnly ( ) ) { final byte [ ] tmp2 = new byte [ 100 ] ; r . nextBytes ( tmp2 ) ; actual . clear ( ) ; actual . put ( tmp2 ) ; actual . flip ( ) ; assertEquals ( expected1 , store . read ( addr1 ) ) ; } } finally { store . destroy ( ) ; } }
test verifies that read does not permit changes to the store state by modifying the returned buffer .
