private static void testSingleKey(String keyIdentifier, Key key) {
    if (key.getParameters().hasIdRequirement()) {
      assertWithMessage(
              keyIdentifier
                  + " has parameters with IdRequirement, but getIdRequirementOrNull returns null")
          .that(key.getIdRequirementOrNull())
          .isNotNull();
    } else {
      assertWithMessage(
              keyIdentifier
                  + " has parameters without IdRequirement, but getIdRequirementOrNull returns a"
                  + " non-null value")
          .that(key.getIdRequirementOrNull())
          .isNull();
    }
  }
Helps check correctness of implementations of "equalsKey".

<p>This is similar to the Guava class {@code EqualsTester}, but uses {@code equalsKey} instead of
{@code equals}, and tests additional properties which are useful for keys only.

<p>Usage example:

<pre>
new KeyTester()
    .addEqualityGroup("128 bit AES Gcm Key", fixed128bitAesGcmKey(), fixed128bitAesGcmKey())
    .addEqualityGroup("256 bit AES Gcm Key", fixed256bitAesGcmKey(), fixed256bitAesGcmKey())
    .doTests();
</pre>

<p>Compared to the Guava {@code EqualsTester}, the user has to specify a name for each group
because keys cannot have a useful {@code toString} method.

<p>This API is currently internal. If needed, we can consider adding it to the public API after
we have some experience with it.
java_src/src/main/java/com/google/crypto/tink/internal/KeyTester.java