@Test
    public void testCipher_Update_WithZeroLengthInput_ReturnsNull() throws Exception {
        Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
        c.init(Cipher.ENCRYPT_MODE, AES_128_KEY);
        assertNull(c.update(new byte[0]));
        assertNull(c.update(new byte[c.getBlockSize() * 2], 0, 0));

        // Try with non-zero offset just in case the implementation mixes up offset and inputLen
        assertNull(c.update(new byte[c.getBlockSize() * 2], 16, 0));
    }
Helper for testing that Cipher.update() throws IllegalStateException when
initialized in modes other than DECRYPT or ENCRYPT.
common/src/test/java/org/conscrypt/javax/crypto/CipherTest.java