CipherTest: cover additional cases that should throw IllegalStateException.
The new logic tests that the following Cipher methods throws
IllegalStateException when the Cipher instance has been
initialized to any mode other than the following:
- update(), final(): only ENCRYPT_MODE or DECRYPT_MODE allowed
- wrap(): only WRAP allowed
- unwrap: only UNWRAP allowed
Tested:
- tested that each one of the new test methods failed after I
I deliberated broke the Cipher implementation to not throw in
these cases. (No other tests broke, i.e. this behavior was
previously not tested by this Test class nor any of the other
two CipherTest.java that I ran).
- tested that the test passes after I reverted my breaking
changes to Cipher.java
Command used to test:
vogar --classpath \
out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jack \
--classpath \
./out/target/common/obj/APPS/CtsKeystoreTestCases_intermediates/classes.jack \
--classpath \
./out/target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates/classes.jack \
libcore/luni/src/test/java/libcore/javax/crypto/CipherTest.java
Bug: 21696383
Change-Id: I4c8fed3cc436d1dfbfd56495bc9232cbb6156dd7
1 file changed