@Test
  @SuppressWarnings("deprecation") // This is a test that the deprecated function works.
  public void deprecatedFactoryGetPrimitive_whenWrapperHasNotBeenRegistered_works()
      throws Exception {
    AeadConfig.register();
    // Only register EciesAeadHkdfPrivateKeyManager, but not HybridEncryptWrapper and
    // HybridDecryptWrapper.
    EciesAeadHkdfPrivateKeyManager.registerPair(/*newKeyAllowed=*/ true);
    KeysetHandle privateHandle =
        KeysetHandle.generateNew(KeyTemplates.get("ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM"));
    KeysetHandle publicHandle = privateHandle.getPublicKeysetHandle();

    HybridEncrypt encrypter = HybridEncryptFactory.getPrimitive(publicHandle);
    HybridDecrypt decrypter = HybridDecryptFactory.getPrimitive(privateHandle);

    byte[] plaintext = "plaintext".getBytes(UTF_8);
    byte[] contextInfo = "contextInfo".getBytes(UTF_8);
    byte[] ciphertext = encrypter.encrypt(plaintext, contextInfo);
    assertThat(decrypter.decrypt(ciphertext, contextInfo)).isEqualTo(plaintext);
  }
Unit test for {@link HybridEncryptFactory} and {@link HybridDecrytFactory}.

<p>The test case in this file needs {@link Registry} to not have HybridDecrytWrapper registered.
That's why it is in its own test file.
java_src/src/test/java/com/google/crypto/tink/hybrid/HybridEncryptDecryptFactoryWithoutWrapperRegisteredTest.java