### Question:
BeanDefinitionParserHelper { public ManagedList<Object> getChildBeansOrReferences(Element element) { ManagedList<Object> list = new ManagedList<Object>(); list.setSource(getSource()); if (element != null) { List<Element> elements = DomUtils.getChildElementsByTagName(element, new String[] { "bean", "ref" }); for (Element child : elements) { Object bean = getParserContext().getDelegate().parsePropertySubElement(child, null); list.add(bean); } } return list; } BeanDefinitionParserHelper(Element element, ParserContext parserContext); Element getElement(); ParserContext getParserContext(); Object getSource(); CompositeComponentDefinition getComponentDefinition(); RootBeanDefinition rootBeanDefinition(Class<?> beanClass); RootBeanDefinition rootBeanDefinition(Class<?> beanClass, int role); RegisteredBeanDefinition register(Class<?> beanClass); RegisteredBeanDefinition register(Class<?> beanClass, int role); RegisteredBeanDefinition register(BeanDefinition definition); ManagedList<Object> getChildBeansOrReferences(Element element);  }### Answer:
@Test public void shouldGetChildBeansOrReferences() throws Exception { NodeList childNodes = mock(NodeList.class); Element child0 = mock(Element.class); given(child0.getLocalName()).willReturn("bean"); Element child1 = mock(Element.class); given(child1.getLocalName()).willReturn("other"); Element child2 = mock(Element.class); given(child2.getLocalName()).willReturn("ref"); given(childNodes.getLength()).willReturn(3); given(childNodes.item(0)).willReturn(child0); given(childNodes.item(1)).willReturn(child1); given(childNodes.item(2)).willReturn(child2); given(this.element.getChildNodes()).willReturn(childNodes); Object bean = mock(Object.class, "bean"); Object ref = mock(Object.class, "ref"); given(this.delegate.parsePropertySubElement(child0, null)).willReturn(bean); given(this.delegate.parsePropertySubElement(child2, null)).willReturn(ref); ManagedList<Object> childBeansOrReferences = this.helper.getChildBeansOrReferences(this.element); assertThat(childBeansOrReferences.size(), is(2)); assertThat(childBeansOrReferences.get(0), is(bean)); assertThat(childBeansOrReferences.get(1), is(ref)); }