@Test
  public void testSerializeFromLegacyFormat() throws Exception {
    KeyTemplate template =
        KeyTemplate.newBuilder()
            .setValue(ByteString.copyFrom(Hex.decode("80")))
            .setOutputPrefixType(OutputPrefixType.TINK)
            .setTypeUrl("SomeInvalidTypeURL")
            .build();
    LegacyProtoParameters legacyParameters =
        new LegacyProtoParameters(ProtoParametersSerialization.create(template));

    byte[] serialized = TinkProtoParametersFormat.serialize(legacyParameters);

    assertThat(KeyTemplate.parseFrom(serialized, ExtensionRegistryLite.getEmptyRegistry()))
        .isEqualTo(template);
  }
When serializing a legacy object, we always succeed, even if an object is registered.
java_src/src/test/java/com/google/crypto/tink/TinkProtoParametersFormatTest.java