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

    byte[] key = Random.randBytes(KEY_SIZE_IN_BYTES);
    InsecureNonceChaCha20Poly1305 cipher = createInstance(key);
    byte[] message = new byte[0];
    byte[] aad = new byte[0];
    HashSet<String> ciphertexts = new HashSet<>();
    final int samples = 1 << 10;
    for (int i = 0; i < samples; i++) {
      byte[] nonce = Random.randBytes(NONCE_SIZE_IN_BYTES);
      byte[] ct = cipher.encrypt(nonce, message, aad);
      String ctHex = Hex.encode(ct);
      assertThat(ciphertexts).doesNotContain(ctHex);
      ciphertexts.add(ctHex);
    }
    assertThat(ciphertexts).hasSize(samples);
  }
This test simply checks that multiple ciphertexts of the same message with a different nonce
are distinct.
java_src/src/test/java/com/google/crypto/tink/aead/internal/InsecureNonceChaCha20Poly1305Test.java