@Theory
  public void getPrimitiveFromNonDeterministicAeadKeyset_throws() throws Exception {
    KeysetHandle handle =
        TinkJsonProtoKeysetFormat.parseKeyset(JSON_AEAD_KEYSET, InsecureSecretKeyAccess.get());
    // Test that the keyset can create a Aead primitive, but not a DeterministicAead.
    Object unused = handle.getPrimitive(Aead.class);
    assertThrows(
        GeneralSecurityException.class, () -> handle.getPrimitive(DeterministicAead.class));
  }
Unit tests for the Daead package. Uses only the public API.
java_src/src/test/java/com/google/crypto/tink/daead/DaeadTest.java