}
// PASS
logger.fine("Method works as expected.");
logger.fine("Set security manager to SCSSecurityManager.");
SCSSecurityManager sm = new SCSSecurityManager();
System.setSecurityManager(sm);
policy.resetCallsNum();
sc = Security.getContext();
if (sm.getCallsNum() != 1) {
// FAIL
throw new TestException(
"'getContext' method of installed security manager was "
+ "called " + sm.getCallsNum() + " times while 1 "
+ "call was expected.");
}
if (policy.getCallsNum() != 0) {
// FAIL
throw new TestException(
"'getContext' method of installed policy provider was "
+ "called " + policy.getCallsNum()
+ " times while no calls were expected.");
}
if (!sc.equals(sm.getContext())) {
// FAIL
throw new TestException(
"'Security.getContext()' method returned " + sc
+ " SecurityPolicy while " + sm.getContext()
+ " was expected.");
}
// PASS
logger.fine("Method works as expected.");