Examples of IThrowableToElement


Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

    public CError() {
        // inject into our ErrorDocument the configured IThrowableToElement that
        // will translate from Throwables to XML that we can render

        try {
            IThrowableToElement throwableToElement = ThrowableToElementLocator.getThrowableToElement();
            this.errorDocument.setThrowableToElement(throwableToElement);
        }
        catch (Exception e) {
            // do not allow a Beans failure to break CError
            log.warn("Failed to retrieve mapping from throwables to Elements for CError rendering from the WebApplicationContext, the default mapping will be used.", e);
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

        super.tearDown();
    }
   
    public final void testThrowableToElement() throws ParserConfigurationException, FactoryConfigurationError {

        IThrowableToElement throwableToElement
            = getThrowableToElementInstance();
       
        Throwable supportedThrowable
            = supportedThrowable();
       
        Class supportedThrowableClass = supportedThrowable.getClass();
       
        assertTrue(throwableToElement.supports(supportedThrowableClass));
       
        Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
      
        Element e = throwableToElement.throwableToElement(supportedThrowable, dom);
        assertEquals(dom, e.getOwnerDocument());
        assertEquals("throwable", e.getNodeName());
        assertEquals(supportedThrowableClass.getName(),
                e.getAttribute("renderedAs"));
        assertEquals(supportedThrowableClass.getName(),
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

     * @throws ParserConfigurationException
     */
    public final void testThrowableToElementUnsupported() throws ParserConfigurationException, FactoryConfigurationError{
        try{
            Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            IThrowableToElement throwableToElement
                = getThrowableToElementInstance();
            Throwable unsupportedThrowable = unsupportedThrowable();
            throwableToElement.throwableToElement(unsupportedThrowable, dom);
        } catch (IllegalArgumentException iae) {
            // good
            return;
        }
        fail("Should have thrown IAE.");
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

     * @throws ParserConfigurationException
     */
    public final void testThrowableToElementNullThrowable() throws ParserConfigurationException, FactoryConfigurationError {
        try{
            Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            IThrowableToElement throwableToElement
                = getThrowableToElementInstance();
            throwableToElement.throwableToElement(null, dom);
        } catch (IllegalArgumentException iae) {
            // good
            return;
        }
        fail("Should have thrown IAE.");
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

     * throws IllegalArgumentException
     */
    public final void testThrowableToElementNullDocument() {
        Throwable t = new Throwable();
        try{
            IThrowableToElement throwableToElement
                = getThrowableToElementInstance();
            throwableToElement.throwableToElement(t, null);
        } catch (IllegalArgumentException iae) {
            // good
            return;
        }
        fail("Should have thrown IAE.");
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

     * Test that calling supports(null) throws
     * IllegalArgumentException.
     */
    public final void testSupportsNull() {
       try{
           IThrowableToElement throwableToElement
               = getThrowableToElementInstance();
           throwableToElement.supports(null);
       } catch (IllegalArgumentException iae) {
           // good
           return;
       }
       fail("Should have thrown IAE.");
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

     * Test that calling supports(c) throws
     * IllegalArgumentException when c is not and does not extend Throwable.
     */
    public final void testSupportsNonThrowable() {
       try{
           IThrowableToElement throwableToElement
               = getThrowableToElementInstance();
           throwableToElement.supports(Integer.class);
       } catch (IllegalArgumentException iae) {
           // good
           return;
       }
       fail("Should have thrown IAE.");
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

    /**
     * Test that calling supports(c) returns either true or false (does not throw
     * an exception) when the class is Throwable.
     */
    public void testSupportsThrowable() {
       IThrowableToElement throwableToElement
           = getThrowableToElementInstance();
       throwableToElement.supports(Throwable.class);
    }
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

   
    /**
     * Test that supports() returns false for an unsupported throwable.
     */
    public  final void testUnsupported(){
        IThrowableToElement throwableToElement
            = getThrowableToElementInstance();
        Throwable unsupportedThrowable = unsupportedThrowable();
        if (unsupportedThrowable != null)
            assertFalse(throwableToElement.supports(Throwable.class));
    }
View Full Code Here

Examples of org.jasig.portal.channels.error.error2xml.IThrowableToElement

   
    /**
     * Test that supports() returns true for a supported throwable.
     */
    public final void testSupported(){
        IThrowableToElement throwableToElement
            = getThrowableToElementInstance();
        Throwable supportedThrowable = supportedThrowable();
        if (supportedThrowable != null)
            assertTrue(throwableToElement.supports(supportedThrowable.getClass()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.