@Test
public void fromBytes() {

    FDBRecordVersion version1 = FDBRecordVersion.incomplete(1);
    FDBRecordVersion version2 = FDBRecordVersion.fromBytes(version1.toBytes());
    assertFalse(version2.isComplete());
    assertEquals(1, version2.getLocalVersion());
    assertEquals(version1, version2);
    assertTrue(version2.toBytes(false) != version1.toBytes(false));
    FDBRecordVersion version3 = FDBRecordVersion.complete(VERSION_BYTES_THREE, 2);
    FDBRecordVersion version4 = FDBRecordVersion.fromBytes(version3.toBytes());
    assertTrue(version4.isComplete());
    assertEquals(2, version4.getLocalVersion());
    assertArrayEquals(VERSION_BYTES_THREE, version4.getGlobalVersion());
    assertEquals(version3, version4);
    assertTrue(version3.toBytes(false) != version4.toBytes(false));
    FDBRecordVersion version5 = FDBRecordVersion.fromBytes(version3.toBytes(false), false);
    assertTrue(version5.isComplete());
    assertEquals(2, version5.getLocalVersion());
    assertArrayEquals(VERSION_BYTES_THREE, version5.getGlobalVersion());
    assertEquals(version3, version5);
    assertEquals(version4, version5);
    assertTrue(version3.toBytes(false) == version5.toBytes(false));
    FDBRecordVersion version6 = FDBRecordVersion.fromBytes(VERSION_BYTES_FOUR, false);
    assertTrue(version6.toBytes(false) == VERSION_BYTES_FOUR);
    assertEquals(0, version6.getLocalVersion());
    assertTrue(version6.isComplete());
    FDBRecordVersion version7 = FDBRecordVersion.fromBytes(VERSION_BYTES_FIVE);
    assertTrue(version7.toBytes(false) != VERSION_BYTES_FIVE);
    assertArrayEquals(VERSION_BYTES_FIVE, version7.toBytes(false));
    assertEquals(0xffff, version7.getLocalVersion());
    assertThat(version7.getLocalVersion(), greaterThan(0));
}