Code example for ExemptionMechanism

Methods: genExemptionBlob, init, isCryptoAllowed

0
            fail("NoSuchProviderException must be thrown");
        } catch (NoSuchProviderException pe) {
            //expected 
        } 
        try { 
            ExemptionMechanism.getInstance("AlgName", (String)null);
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException e) {
            //expected 
        } 
    } 
     
    /** 
     * Test for <code>isCryptoAllowed(Key key)</code> method  
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "isCryptoAllowed", 
        args = {java.security.Key.class}
    ) 
    public void testIsCryptoAllowed() throws Exception { 
 
        //Regression for HARMONY-1029 
        Provider mProv = (new SpiEngUtils()).new MyProvider("MyExMechProvider",
                "Provider for ExemptionMechanism testing", 
                srvExemptionMechanism.concat(".").concat(defaultAlg),
                ExemptionMechanismProviderClass);
 
        ExemptionMechanism em = new ExemptionMechanism(