public void test_writeImmutable(){
  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());
    assertEquals(expected1,store.read(addr1));
    final byte[] expected2=expected1.clone();
    r.nextBytes(expected1);
    assertEquals(expected2,store.read(addr1));
  }
  finally {
    store.destroy();
  }
}

public void test_writeImmutable ( ) { 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 ( ) ) ; assertEquals ( expected1 , store . read ( addr1 ) ) ; final byte [ ] expected2 = expected1 . clone ( ) ; r . nextBytes ( expected1 ) ; assertEquals ( expected2 , store . read ( addr1 ) ) ; } finally { store . destroy ( ) ; } }
test verifies that write does not permit changes to the store state by modifying the supplied buffer after the write operation ( i . e . , a copy is made of the data in the buffer ) .
