@Test
public void serializeKey() {

    List<Tuple> sortedTuples = TEST_TUPLES.stream().sorted().collect(Collectors.toList());
    List<Tuple> sortedKeys = TEST_TUPLES.stream()
            .map(serializer::serializeKey)
            .sorted(ByteArrayUtil::compareUnsigned)
            .map(serializer::deserializeKey)
            .collect(Collectors.toList());
    assertEquals(sortedTuples, sortedKeys);
    // Add a subspace and make sure unpacking by length works.
    Subspace subspace = new Subspace(Tuple.from("fake", "subspace"));
    List<Tuple> prefixedTuples = TEST_TUPLES.stream()
            .map(serializer::serializeKey)
            .map(b -> ByteArrayUtil.join(subspace.getKey(), b))
            .map(data -> serializer.deserializeKey(data, subspace.getKey().length))
            .collect(Collectors.toList());
    assertEquals(TEST_TUPLES, prefixedTuples);
}