@Theory
  public void readKeysetEncryptDecrypt()
      throws Exception {
    KeysetHandle handle =
        TinkJsonProtoKeysetFormat.parseKeyset(JSON_MAC_KEYSET, InsecureSecretKeyAccess.get());

    Mac mac = handle.getPrimitive(Mac.class);

    byte[] data = "data".getBytes(UTF_8);
    byte[] tag = mac.computeMac(data);
    mac.verifyMac(tag, data);
  }
Unit tests for the Mac package. Uses only the public API.
java_src/src/test/java/com/google/crypto/tink/mac/MacTest.java