public static void checkPermission(AppPermission.Type permission) {
        SecurityManager sm = System.getSecurityManager();
        if (sm == null) {
            return;
        }
        AccessControlContext context = AccessController.getContext();
        if (context == null) {
            sm.checkPermission(new AppPermission((permission)));
        } else {
            int contextHash = context.hashCode() ^ permission.hashCode();
            PermissionCheckCache.getInstance().checkCache(contextHash, new AppPermission(permission));
        }
    }
@Test(expected = AccessControlException.class)
    public void testCheckPermission() throws Exception {
        SecurityManager sm = new SecurityManager();
        sm.checkPermission(new AppPermission((AppPermission.Type.APP_EVENT)));
    }