@Test
  public void parseFromKeyset_works() throws Exception {
    AesSivKey protoKey =
        AesSivKey.newBuilder().setVersion(0).setKeyValue(ByteString.copyFrom(KEY_BYTES)).build();
    KeysetHandle handle = getKeysetHandleFromProtoKey(protoKey, OutputPrefixType.TINK);

    Keyset keyset =
        Keyset.parseFrom(
            TinkProtoKeysetFormat.serializeKeyset(handle, InsecureSecretKeyAccess.get()),
            ExtensionRegistryLite.getEmptyRegistry());

    assertThat(keyset.getPrimaryKeyId()).isEqualTo(KEY_ID);
    assertThat(keyset.getKeyCount()).isEqualTo(1);
    assertThat(keyset.getKey(0).getKeyId()).isEqualTo(KEY_ID);
    assertThat(keyset.getKey(0).getStatus()).isEqualTo(KeyStatusType.ENABLED);
    assertThat(keyset.getKey(0).getOutputPrefixType()).isEqualTo(OutputPrefixType.TINK);
    assertThat(keyset.getKey(0).getKeyData().getTypeUrl()).isEqualTo(TYPE_URL);
    assertThat(keyset.getKey(0).getKeyData().getKeyMaterialType())
        .isEqualTo(KeyMaterialType.SYMMETRIC);
    assertThat(
            AesSivKey.parseFrom(
                keyset.getKey(0).getKeyData().getValue(), ExtensionRegistryLite.getEmptyRegistry()))
        .isEqualTo(protoKey);
  }
This test attempts to test the case where a user registers their own key type with
Registry.registerKeyManager() and then uses it.
java_src/src/test/java/com/google/crypto/tink/daead/KeyManagerIntegrationTest.java