@Test
public void testAligned() {

  byte[] reference = TestUtil.buildTestData(DATA_LENGTH);
  byte[] data = reference.clone();
  Random random = new Random(RANDOM_SEED);
  int offset = 0;
  while (offset < data.length) {
    int bytes = (1 + random.nextInt(50)) * 16;
    bytes = Math.min(bytes, data.length - offset);
    assertThat(bytes % 16).isEqualTo(0);
    encryptCipher.updateInPlace(data, offset, bytes);
    offset += bytes;
  }
  int unchangedByteCount = data.length - getDifferingByteCount(reference, data);
  assertThat(unchangedByteCount <= getMaxUnchangedBytesAllowedPostEncryption(data.length))
      .isTrue();
  offset = 0;
  while (offset < data.length) {
    int bytes = (1 + random.nextInt(50)) * 16;
    bytes = Math.min(bytes, data.length - offset);
    assertThat(bytes % 16).isEqualTo(0);
    decryptCipher.updateInPlace(data, offset, bytes);
    offset += bytes;
  }
  int differingByteCount = getDifferingByteCount(reference, data);
  assertThat(differingByteCount).isEqualTo(0);
}