Mock componentAdapterMock = mock(ComponentAdapter.class);
componentAdapterMock.expects(atLeastOnce()).method("getComponentKey").will(returnValue("x"));
Mock containerMock = mock(PicoContainer.class);
containerMock.expects(once()).method("getComponentAdapters").withNoArguments().will(returnValue(new HashSet()));
containerMock.expects(once()).method("getComponentAdaptersOfType").with(eq(String.class)).will(
returnValue(Arrays.asList(new ComponentAdapter[]{
new InstanceComponentAdapter("y", "Hello"), new InstanceComponentAdapter("z", "World")})));
containerMock.expects(once()).method("getComponentInstance").with(eq("z")).will(returnValue("World"));
containerMock.expects(once()).method("getComponentInstance").with(eq("y")).will(returnValue("Hello"));
containerMock.expects(once()).method("getParent").withNoArguments().will(returnValue(null));