use of org.apache.harmony.security.tests.support.MyLoadStoreParams in project robovm by robovm.
the class MyCertificate method test_engineLoadLjava_security_KeyStore_LoadStoreParameter.
/**
* java.security.KeyStoreSpi#engineLoad(KeyStore.LoadStoreParameter)
*/
public void test_engineLoadLjava_security_KeyStore_LoadStoreParameter() throws Exception {
final String msg = "error";
KeyStoreSpi ksSpi = new MyKeyStoreSpi() {
public void engineLoad(InputStream stream, char[] password) {
assertNull(stream);
assertNull(password);
throw new RuntimeException(msg);
}
};
try {
ksSpi.engineLoad(null);
fail("Should throw exception");
} catch (RuntimeException expected) {
assertSame(msg, expected.getMessage());
}
// test: protection parameter is null
try {
ksSpi.engineLoad(new MyLoadStoreParams(null));
fail("No expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
// PasswordProtection or CallbackHandlerProtection
try {
ksSpi.engineLoad(new MyLoadStoreParams(new BadKeyStoreProtectionParameter()));
fail("No expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
}
Aggregations