@Test
  public void testLongMessages() throws Exception {
    Assume.assumeFalse(TinkFips.useOnlyFips());
    Assume.assumeTrue(InsecureNonceChaCha20Poly1305Jce.isSupported());
    Assume.assumeFalse(TestUtil.isAndroid()); // Doesn't work on Android

    int dataSize = 16;
    while (dataSize <= (1 << 24)) {
      byte[] plaintext = Random.randBytes(dataSize);
      byte[] aad = Random.randBytes(dataSize / 3);
      byte[] key = Random.randBytes(KEY_SIZE_IN_BYTES);
      byte[] nonce = Random.randBytes(NONCE_SIZE_IN_BYTES);
      InsecureNonceChaCha20Poly1305Jce cipher = createInstance(key);
      byte[] ciphertext = cipher.encrypt(nonce, plaintext, aad);
      byte[] decrypted = cipher.decrypt(nonce, ciphertext, aad);
      assertArrayEquals(plaintext, decrypted);
      dataSize += 5 * dataSize / 11;
    }
  }
BC had a bug, where GCM failed for messages of size > 8192
java_src/src/test/java/com/google/crypto/tink/aead/internal/InsecureNonceChaCha20Poly1305JceTest.java