@Test
  public void testBuilder_copyKeyset_originalHasInvalidKey_throws() throws Exception {
    Keyset keyset =
        Keyset.newBuilder()
            .setPrimaryKeyId(1)
            .addKey(
                Keyset.Key.newBuilder()
                    .setKeyId(1)
                    .setStatus(KeyStatusType.ENABLED)
                    .setKeyData(
                        KeyData.newBuilder()
                            .setTypeUrl("type.googleapis.com/google.crypto.tink.AesGcmKey")
                            .setValue(ByteString.EMPTY)))
            .build();
    KeysetHandle.Builder builder = KeysetHandle.newBuilder(KeysetHandle.fromKeyset(keyset));
    GeneralSecurityException thrown = assertThrows(GeneralSecurityException.class, builder::build);
    assertThat(thrown)
        .hasCauseThat()
        .hasMessageThat()
        .contains("wrong status or key parsing failed");
  }
Tests that key parsing via the serialization registry works as expected.

<p>NOTE: This adds a parser to the MutableSerializationRegistry, which no other test uses.
java_src/src/test/java/com/google/crypto/tink/KeysetHandleTest.java