Package java.beans

Examples of java.beans.Encoder$DefaultExceptionListener


     */
    public void testInstantiate_NotRegularGetter() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate(
                new String[] { "prop" });
        MockFoo2 b = new MockFoo2(2);
        Expression e = pd.instantiate(b, new Encoder());

        assertSame(b, e.getValue());
        assertSame(MockFoo2.class, e.getTarget());
        assertEquals("new", e.getMethodName());
        assertEquals(1, e.getArguments().length);
View Full Code Here


        bean1.setValueCalled = false;
        bean2.setValueCalled = false;

        MockPersistenceDelegate mockPersistenceDelegate = new MockPersistenceDelegate();
        mockPersistenceDelegate.initialize(MockBean3.class, bean1, bean2,
                new Encoder());
        assertEquals("bean1", bean1.getValue());
        assertEquals("bean2", bean2.getValue());
        assertFalse(bean1.setValueCalled);
        assertFalse(bean2.setValueCalled);
    }
View Full Code Here

    /*
     * Tests initialize() with null class.
     */
    public void testInitialize_NullClass() {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        Encoder enc = new Encoder();
        Object o1 = new Object();
        Object o2 = new Object();
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        try {
            enc.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    CallVerificationStack.getInstance().push(e);
                }
            });
            pd.initialize(null, o1, o2, enc);
View Full Code Here

    /*
     * Tests initialize() with null old and new instances.
     */
    public void testInitialize_NullInstances() {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        Encoder enc = new Encoder();
        MockFoo b = new MockFoo();
        b.setName("myName");
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        try {
View Full Code Here

    /*
     * Tests array persistence delegate
     */
    public void testArrayPD_Normal() {
        Encoder enc = new MockEncoder();
        int[] ia = new int[] { 1 };
        PersistenceDelegate pd = enc.getPersistenceDelegate(ia.getClass());
        pd.writeObject(ia, enc);
    }
View Full Code Here

        // TBD
    }

    public void testInstantiate_Normal() throws Exception {
        Object obj = new int[] { 1, 2, 3 };
        Expression exp = pd.instantiate(obj, new Encoder());
        assertSame(obj, exp.getValue());
        assertSame(Array.class, exp.getTarget());
        assertEquals("newInstance", exp.getMethodName());
        assertEquals(2, exp.getArguments().length);
        assertSame(Integer.TYPE, exp.getArguments()[0]);
View Full Code Here

     */
    public void testInstantiate_Normal() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] {
                "prop1", "prop2" });
        MockBean b = new MockBean();
        Encoder enc = new Encoder();
        b.setAll("bean1", 2);
        Expression e = pd.instantiate(b, enc);
        assertSame(b, e.getValue());
        assertSame(MockBean.class, e.getTarget());
        assertEquals("new", e.getMethodName());
View Full Code Here

     * Test instantiate() with null instance.
     */
    public void testInstantiate_NullInstance() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] {
                "prop1", "prop2" });
        Encoder enc = new Encoder();
        try {
            pd.instantiate(null, enc);
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
View Full Code Here

    public void testInstantiate_NullProperty() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate(new String[] {
                "prop1", null });
        MockBean b = new MockBean();
        b.setAll("bean1", 2);
        pd.instantiate(b, new Encoder());
       
        pd = new MockPersistenceDelegate(new String[] {
                "prop1", null, "prop2"});
        MockBean b2 = new MockBean();
        b2.setAll("bean1", 2);
        pd.instantiate(b2, new Encoder());
    }
View Full Code Here

     */
    public void testInstantiate_NoProperty() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        MockBean b = new MockBean();
        b.setAll("bean1", 2);
        Expression e = pd.instantiate(b, new Encoder());
        assertSame(b, e.getValue());
        assertSame(MockBean.class, e.getTarget());
        assertEquals("new", e.getMethodName());
        assertEquals(0, e.getArguments().length);
    }
View Full Code Here

TOP

Related Classes of java.beans.Encoder$DefaultExceptionListener

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.