}
@Test
public void replaceTest() throws StorageException {
StaticBuffer key = new StaticArrayBuffer("replacement_test_key".getBytes());
byte[] initialValue = "initial value".getBytes();
byte[] replacementV = "replacement".getBytes();
store.replace(key, new StaticArrayBuffer(initialValue), null, tx);
// let's first check if it was successfully added as a new value
Assert.assertTrue(store.containsKey(key, tx));
Assert.assertArrayEquals(initialValue, store.get(key, tx).as(StaticArrayBuffer.ARRAY_FACTORY));
// now let's commit transaction and check if the key is this around
commitTransaction();
// let's first check if value was retained after first transaction
Assert.assertTrue(store.containsKey(key, tx));
Assert.assertArrayEquals(initialValue, store.get(key, tx).as(StaticArrayBuffer.ARRAY_FACTORY));
store.replace(key, new StaticArrayBuffer(replacementV), new StaticArrayBuffer(initialValue), tx);
// let's check if the value was replaced correctly
Assert.assertArrayEquals(replacementV, store.get(key, tx).as(StaticArrayBuffer.ARRAY_FACTORY));
// now let's commit transaction and check if update would be retained