Package org.apache.harmony.beans.tests.support.mock

Examples of org.apache.harmony.beans.tests.support.mock.MockExceptionListener


            }
        }
       
        XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
                "<java><string/>".getBytes("UTF-8")));
        MockExceptionListener mockListener = new MockExceptionListener();
        xmlDecoder.setExceptionListener(mockListener);
       
        assertFalse(mockListener.isCalled());       
        // Real Parsing should occur in method of ReadObject rather constructor.
        assertNotNull(xmlDecoder.readObject());
        assertTrue(mockListener.isCalled());
    }
View Full Code Here


        Object defaultL = dec.getExceptionListener();

        dec.setExceptionListener(null);
        assertSame(defaultL, dec.getExceptionListener());

        ExceptionListener newL = new MockExceptionListener();
        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }
View Full Code Here

        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }

    public void testSetExceptionListener_CatchException() {
        MockExceptionListener l = new MockExceptionListener();
        new XMLDecoder(XMLDecoderTest.class
                .getResourceAsStream("/xml/bad_int.xml"), null, l);
        assertTrue(l.size() > 0);
    }
View Full Code Here

     * Class under test for void XMLDecoder(java.io.InputStream,
     * java.lang.Object, java.beans.ExceptionListener)
     */
    public void testXMLDecoderInputStreamObjectExceptionListener() {
        String owner = "owner";
        MockExceptionListener l = new MockExceptionListener();
        XMLDecoder dec = new XMLDecoder(new ByteArrayInputStream(xml123bytes),
                owner, l);
        assertSame(owner, dec.getOwner());
        assertSame(l, dec.getExceptionListener());
    }
View Full Code Here

        Object defaultL = dec.getExceptionListener();

        dec.setExceptionListener(null);
        assertSame(defaultL, dec.getExceptionListener());

        ExceptionListener newL = new MockExceptionListener();
        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }
View Full Code Here

        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }

    public void testSetExceptionListener_CatchException() {
        MockExceptionListener l = new MockExceptionListener();
        new XMLDecoder(XMLDecoderTest.class
                .getResourceAsStream("/xml/bad_int.xml"), null, l);
        assertTrue(l.size() > 0);
    }
View Full Code Here

     * Class under test for void XMLDecoder(java.io.InputStream,
     * java.lang.Object, java.beans.ExceptionListener)
     */
    public void testXMLDecoderInputStreamObjectExceptionListener() {
        String owner = "owner";
        MockExceptionListener l = new MockExceptionListener();
        XMLDecoder dec = new XMLDecoder(new ByteArrayInputStream(xml123bytes),
                owner, l);
        assertSame(owner, dec.getOwner());
        assertSame(l, dec.getExceptionListener());
    }
View Full Code Here

        Object defaultL = dec.getExceptionListener();

        dec.setExceptionListener(null);
        assertSame(defaultL, dec.getExceptionListener());

        ExceptionListener newL = new MockExceptionListener();
        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }
View Full Code Here

        dec.setExceptionListener(newL);
        assertSame(newL, dec.getExceptionListener());
    }

    public void testSetExceptionListener_CatchException() {
        MockExceptionListener l = new MockExceptionListener();
        new XMLDecoder(XMLDecoderTest.class
                .getResourceAsStream("/xml/bad_int.xml"), null, l);
        assertTrue(l.size() > 0);
    }
View Full Code Here

     * Class under test for void XMLDecoder(java.io.InputStream,
     * java.lang.Object, java.beans.ExceptionListener)
     */
    public void testXMLDecoderInputStreamObjectExceptionListener() {
        String owner = "owner";
        MockExceptionListener l = new MockExceptionListener();
        XMLDecoder dec = new XMLDecoder(new ByteArrayInputStream(xml123bytes),
                owner, l);
        assertSame(owner, dec.getOwner());
        assertSame(l, dec.getExceptionListener());
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.beans.tests.support.mock.MockExceptionListener

Copyright © 2018 www.massapicom. 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.