@Theory
  public void readKeysetEncryptDecrypt()
      throws Exception {
    KeysetHandle handle =
        TinkJsonProtoKeysetFormat.parseKeyset(JSON_PRF_KEYSET, InsecureSecretKeyAccess.get());
    PrfSet prfSet = handle.getPrimitive(PrfSet.class);

    byte[] data = "data".getBytes(UTF_8);
    byte[] output1 = prfSet.computePrimary(data, 12);
    byte[] output2 = prfSet.getPrfs().get(166506972).compute(data, 12);
    assertThat(output2).isEqualTo(output1);
  }
Unit tests for the Prf package. Uses only the public API.
java_src/src/test/java/com/google/crypto/tink/prf/PrfTest.java