@Test
  public void getPrimitive_usesRegistryWhenNoConfigurationProvided() throws Exception {
    KeysetHandle keysetHandle =
        KeysetHandle.newBuilder()
            .addEntry(KeysetHandle.importKey(rawKey).withRandomId().makePrimary())
            .build();
    byte[] plaintext = "plaintext".getBytes(UTF_8);

    ChunkedMac registryMac =
        MutablePrimitiveRegistry.globalInstance().getPrimitive(rawKey, ChunkedMac.class);
    ChunkedMacComputation registryMacComputation = registryMac.createComputation();
    registryMacComputation.update(ByteBuffer.wrap(plaintext));
    ChunkedMac keysetHandleMac = keysetHandle.getPrimitive(ChunkedMac.class);
    ChunkedMacComputation keysetHandleMacComputation = keysetHandleMac.createComputation();
    keysetHandleMacComputation.update(ByteBuffer.wrap(plaintext));

    assertThat(keysetHandleMacComputation.computeMac())
        .isEqualTo(registryMacComputation.computeMac());
  }
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