Code example for Constructor

Methods: getModifiers

0
     
    class SubInvocationTargetException extends InvocationTargetException {}
     
    /** 
     * @tests java.lang.reflect.InvocationTargetException#InvocationTargetException() 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "InvocationTargetException", 
        args = {} 
    ) 
    public void test_Constructor() throws Exception { 
        Constructor<InvocationTargetException> ctor = InvocationTargetException.class
                .getDeclaredConstructor();
        assertNotNull("Parameterless constructor does not exist.", ctor);
        assertTrue("Constructor is not protected", Modifier.isProtected(ctor
                .getModifiers()));
        //create an instance of a subtype using this constructor 
        SubInvocationTargetException subException = new SubInvocationTargetException();
    }