@Test
public final void testSerializeBuffer () {

    final BinaryDataSegment dataSegment = new BinaryDataSegment(CHUNK_SIZE);
    assertNotNull(dataSegment);
    assertEquals(0, dataSegment.getLength());
    final ByteBuffer testBuffer = ByteBuffer.wrap(TEST_CASE_1_ARRAY);
    dataSegment.deserialize(testBuffer, TEST_CASE_1_ARRAY.length);
    assertEquals(TEST_CASE_1_ARRAY.length, dataSegment.getLength());
    final ByteBuffer expectedResult = ByteBuffer.wrap(TEST_CASE_1_ARRAY_LONG);
    dataSegment.dataBuffer.rewind();
    final ByteBuffer exportedDataSegment = ByteBuffer.allocate(AbstractDataSegment.getTotalLength(dataSegment.getLength()));
    dataSegment.serialize(exportedDataSegment, 0);
    exportedDataSegment.rewind();
    assertTrue(expectedResult.equals(exportedDataSegment));
}