public static <K> ShardedKey<K> of(K key, byte[] shardId) {
    checkArgument(key != null, "Key should not be null!");
    checkArgument(shardId != null, "Shard id should not be null!");
    return new ShardedKey<K>(key, shardId);
  }
@Test
  public void testDecodeEncodeEqual() throws Exception {
    Coder<ShardedKey<String>> coder = ShardedKey.Coder.of(StringUtf8Coder.of());
    CoderProperties.coderDecodeEncodeEqual(coder, ShardedKey.of(KEY, SHARD));
    CoderProperties.coderDecodeEncodeEqual(coder, ShardedKey.of(KEY, EMPTY_SHARD));
    CoderProperties.coderConsistentWithEquals(
        coder,
        ShardedKey.of(KEY, "shard_id".getBytes(UTF_8)),
        ShardedKey.of(KEY, "shard_id".getBytes(UTF_8)));
    CoderProperties.coderConsistentWithEquals(
        coder, ShardedKey.of(KEY, new byte[0]), ShardedKey.of(KEY, new byte[0]));
    CoderProperties.coderDeterministic(
        coder,
        ShardedKey.of(KEY, "shard_id".getBytes(UTF_8)),
        ShardedKey.of(KEY, "shard_id".getBytes(UTF_8)));
    CoderProperties.coderDeterministic(
        coder, ShardedKey.of(KEY, new byte[0]), ShardedKey.of(KEY, new byte[0]));
  }