Package org.picocontainer

Examples of org.picocontainer.PicoVisitor


            exceptionAdapter,
            componentParameter,
            throwableParameter
        });
        List visitedList = new LinkedList();
        PicoVisitor visitor = new RecordingStrategyVisitor(visitedList);
        visitor.traverse(parent);
        assertEquals(expectedList, visitedList);
    }
View Full Code Here


        }
    }
   
    public void testCollectionChildIdVisitedBreadthFirst() {
        Mock             mockVisior = mock(PicoVisitor.class);
        PicoVisitor     visitor = (PicoVisitor) mockVisior.proxy();

        Mock       mockC1 = mock(Constraint.class, "constraint 1");
        Constraint c1     = (Constraint) mockC1.proxy();

        Constraint c = new CollectionConstraint(c1);
View Full Code Here

        }
    }

    public void testThrownRuntimeExceptionIsUnwrapped() {
        Mock mockPico = mock(PicoContainer.class);
        PicoVisitor visitor = new VerifyingVisitor();
        Error exception = new Error("junit");
        mockPico.expects(once()).method("accept").with(same(visitor)).will(
                throwException(new PicoIntrospectionException("message", exception)));
        try {
            visitor.traverse(mockPico.proxy());
            fail("PicoIntrospectionException expected");
        } catch (RuntimeException e) {
            assertEquals("message", e.getMessage());
            assertSame(exception, ((PicoIntrospectionException)e).getCause());
        }
View Full Code Here

        }
    }

    public void testThrownErrorIsUnwrapped() {
        Mock mockPico = mock(PicoContainer.class);
        PicoVisitor visitor = new VerifyingVisitor();
        Error error = new InternalError("junit");
        mockPico.expects(once()).method("accept").with(same(visitor)).id("1");
        mockPico.expects(once()).method("accept").with(same(visitor)).after("1").will(throwException(error));
        visitor.traverse(mockPico.proxy());
        try {
            visitor.traverse(mockPico.proxy());
            fail("UndeclaredThrowableException expected");
        } catch(InternalError e) {
            assertEquals("junit", e.getMessage());
        }
    }
View Full Code Here

        //go to the top of the hierachy
        while (container.getParent() != null) {
            container = container.getParent();
        }

        container.accept(new PicoVisitor() {
                public Object traverse(Object node) {
                    return null;
                }

                public void visitContainer(PicoContainer container) {
View Full Code Here

TOP

Related Classes of org.picocontainer.PicoVisitor

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.