Code example for ExemptionMechanism

Methods: getOutputSizeinit

0
        notes = "Tests Exceptions", 
        method = "getInstance", 
        args = {java.lang.String.class}
    ) 
    public void test_getInstanceLjava_lang_String() throws Exception { 
        try { 
            ExemptionMechanism.getInstance((String) null);
            fail("NullPointerException expected");
        } catch (NullPointerException e) {
            //expected 
        } 
 
        Provider mProv = (new SpiEngUtils()).new MyProvider("MyExMechProvider",
                "Provider for ExemptionMechanism testing", 
                srvExemptionMechanism.concat(".").concat(defaultAlg),
                ExemptionMechanismProviderClass);
     
        ExemptionMechanism em = new ExemptionMechanism(
                new Mock_ExemptionMechanismSpi(), mProv, defaultAlg) {
        }; 
 
        try { 
            em.getInstance("WrongAlgName");
            fail("NoSuchAlgorithmException expected");
        } catch (NoSuchAlgorithmException e) {