Code example for ExemptionMechanism

Methods: init

0
 
        Key key = new MyExemptionMechanismSpi().new tmpKey("Proba", new byte[0]);
         
        try { 
            em.getOutputSize(10);
            fail("IllegalStateException expected");
        } catch (IllegalStateException e) {
            //failed 
        } 
 
        em.init(key);
        assertEquals(10, em.getOutputSize(10));
    } 
 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "getProvider", 
        args = {} 
    ) 
    public void test_getProvider() throws Exception { 
        Provider mProv = (new SpiEngUtils()).new MyProvider("MyExMechProvider",
                "Provider for ExemptionMechanism testing", 
                srvExemptionMechanism.concat(".").concat(defaultAlg),
                ExemptionMechanismProviderClass);
 
        ExemptionMechanism em = new ExemptionMechanism(
                new MyExemptionMechanismSpi(), mProv, defaultAlg) {
        }; 
 
        Key key = new MyExemptionMechanismSpi().new tmpKey("Proba", new byte[0]);
 
        assertEquals(mProv, em.getProvider());
    } 
 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE,