@Test
  public void testRandomNonce() throws Exception {
    Assume.assumeFalse(TinkFips.useOnlyFips());

    final int samples = 1 << 17;
    byte[] key = Random.randBytes(KEY_SIZE);
    byte[] message = new byte[0];
    byte[] aad = Random.randBytes(20);
    AesEaxJce eax = new AesEaxJce(key, IV_SIZE);
    HashSet<String> ciphertexts = new HashSet<>();
    for (int i = 0; i < samples; i++) {
      byte[] ct = eax.encrypt(message, aad);
      String ctHex = Hex.encode(ct);
      assertThat(ciphertexts).doesNotContain(ctHex);
      ciphertexts.add(ctHex);
    }
  }
This is a very simple test for the randomness of the nonce. The test simply checks that the
multiple ciphertexts of the same message are distinct.
java_src/src/test/java/com/google/crypto/tink/subtle/AesEaxJceTest.java