@Test
  public void registerToInternalPrimitiveRegistry_works() throws Exception {
    PrimitiveRegistry.Builder initialBuilder = PrimitiveRegistry.builder();
    PrimitiveRegistry initialRegistry = initialBuilder.build();
    PrimitiveRegistry.Builder processedBuilder = PrimitiveRegistry.builder(initialRegistry);

    HybridDecryptWrapper.registerToInternalPrimitiveRegistry(processedBuilder);
    PrimitiveRegistry processedRegistry = processedBuilder.build();

    assertThrows(
        GeneralSecurityException.class,
        () -> initialRegistry.getInputPrimitiveClass(HybridDecrypt.class));
    assertThat(processedRegistry.getInputPrimitiveClass(HybridDecrypt.class))
        .isEqualTo(HybridDecrypt.class);
  }
This test checks that we decrypt ciphertext even if it is encrypted under a NO_PREFIX
non-primary, the primary is a Tink prefix primary, and the ciphertext matches the prefix by a
2^(-40) probability coincidence.
java_src/src/test/java/com/google/crypto/tink/hybrid/HybridDecryptWrapperTest.java