@Theory
  public void create_computeVerify(@FromDataPoints("templates") String templateName)
      throws Exception {
    KeysetHandle handle = KeysetHandle.generateNew(KeyTemplates.get(templateName));
    int primaryId = handle.getPrimary().getId();
    PrfSet prfSet = handle.getPrimitive(PrfSet.class);

    byte[] data = "data".getBytes(UTF_8);
    byte[] outputPrimary = prfSet.computePrimary(data, 12);
    byte[] output = prfSet.getPrfs().get(primaryId).compute(data, 12);
    assertThat(output).isEqualTo(outputPrimary);

    int invalidId = primaryId + 1;
    assertThat(prfSet.getPrfs().get(invalidId)).isNull();
  }
Unit tests for the Prf package. Uses only the public API.
java_src/src/test/java/com/google/crypto/tink/prf/PrfTest.java