private static void checkCipher_Wrap_invalidMode_Failure(int opmode) throws Exception {
        KeyGenerator kg = KeyGenerator.getInstance("AES");
        kg.init(128);
        SecretKey key = kg.generateKey();
        Cipher cipher = createAesCipher(opmode);
        try {
            cipher.wrap(key);
            fail("wrap() should throw IllegalStateException [mode=" + opmode + "]");
        } catch (IllegalStateException expected) {
        }
    }
Helper for testing that Cipher.wrap() throws IllegalStateException when
initialized in modes other than WRAP.
common/src/test/java/org/conscrypt/javax/crypto/CipherTest.java