@Test
  public void testWithAesEaxKey_crunchyPrefix_works() throws Exception {
    Assume.assumeFalse(TinkFips.useOnlyFips());
    // From the second test vector above.
    byte[] plaintext = Hex.decode("f7fb");
    byte[] associatedData = Hex.decode("fa3bfd4806eb53fa");
    byte[] keyBytes = Hex.decode("91945d3f4dcbee0bf45ef52255f095a4");
    AesEaxParameters parameters =
        AesEaxParameters.builder()
            .setKeySizeBytes(16)
            .setTagSizeBytes(16)
            .setIvSizeBytes(16)
            .setVariant(AesEaxParameters.Variant.CRUNCHY)
            .build();
    AesEaxKey key =
        AesEaxKey.builder()
            .setParameters(parameters)
            .setKeyBytes(SecretBytes.copyFrom(keyBytes, InsecureSecretKeyAccess.get()))
            .setIdRequirement(0x99887766)
            .build();
    Aead aead = AesEaxJce.create(key);
    byte[] ciphertext = aead.encrypt(plaintext, associatedData);
    assertThat(ciphertext)
        .hasLength(
            5 // prefix_length
                + 2 // plaintext_length
                + parameters.getIvSizeBytes()
                + parameters.getTagSizeBytes());

    assertThat(aead.decrypt(ciphertext, associatedData)).isEqualTo(plaintext);

    byte[] fixedCiphertext =
        Hex.decode(
            "0099887766becaf043b0a23d843194ba972c66debd19dd5c4c9331049d0bdab0277408f67967e5");
    assertThat(aead.decrypt(fixedCiphertext, associatedData)).isEqualTo(plaintext);
  }
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