Code example for Permission

Methods: getName

0
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            //expected 
        } 
 
        SecurityManager oldSm = System.getSecurityManager();
        System.setSecurityManager(sm);
        try { 
            Locale.setDefault(Locale.CANADA);
            fail("Should throw SecurityException");
        } catch (SecurityException e) {
            // expected 
        } finally { 
            System.setSecurityManager(oldSm);
        } 
    } 
 
    /** 
     * @tests java.util.Locale#toString() 
     */ 
    @TestTargetNew(