@Test
  public void testImportKey_withoutIdRequirement_noIdAssigned_throws() throws Exception {
    AesCmacParameters params = AesCmacParameters.builder().setKeySizeBytes(32).setTagSizeBytes(10)
        .build();
    AesCmacKey key = AesCmacKey.builder().setParameters(params)
        .setAesKeyBytes(SecretBytes.randomBytes(32)).build();
    KeysetHandle.Builder builder =
        KeysetHandle.newBuilder().addEntry(KeysetHandle.importKey(key).makePrimary());
    assertThrows(GeneralSecurityException.class, builder::build);
  }
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