.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.build();
DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
BlockEncoding blockEncoding = new RunLengthEncoder(sliceOutput).append(expectedBlock).finish();
SliceInput sliceInput = sliceOutput.slice().getInput();
Block block = blockEncoding.readBlock(sliceInput);
assertInstanceOf(block, RunLengthEncodedBlock.class);
RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) block;
assertTrue(rleBlock.equalTo(0, expectedBlock, 0));
assertEquals(rleBlock.getPositionCount(), 2);
assertEquals(rleBlock.getSlice(0).toStringUtf8(), "alice");
block = blockEncoding.readBlock(sliceInput);
assertInstanceOf(block, RunLengthEncodedBlock.class);
rleBlock = (RunLengthEncodedBlock) block;
assertTrue(rleBlock.equalTo(0, expectedBlock, 2));
assertEquals(rleBlock.getPositionCount(), 4);
assertEquals(rleBlock.getSlice(0).toStringUtf8(), "bob");
block = blockEncoding.readBlock(sliceInput);
assertInstanceOf(block, RunLengthEncodedBlock.class);
rleBlock = (RunLengthEncodedBlock) block;
assertTrue(rleBlock.equalTo(0, expectedBlock, 6));
assertEquals(rleBlock.getPositionCount(), 6);
assertEquals(rleBlock.getSlice(0).toStringUtf8(), "charlie");