### Question:
BeanDefinitionParserHelper { public RegisteredBeanDefinition register(Class<?> beanClass) { return register(beanClass, BeanDefinition.ROLE_INFRASTRUCTURE); } 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 shouldRegisterBeanDefinition() throws Exception { String name = "bean"; BeanDefinition defintion = new RootBeanDefinition(Bean.class); given(this.readerContext.registerWithGeneratedName(defintion)).willReturn(name); RegisteredBeanDefinition registeredBeanDefinition = this.helper.register(defintion); verify(this.readerContext).fireComponentRegistered(this.componentCaptor.capture()); BeanComponentDefinition beanComponentDefinition = (BeanComponentDefinition) this.componentCaptor.getValue(); assertThat(beanComponentDefinition.getName(), is(name)); assertThat(beanComponentDefinition.getBeanDefinition(), is(defintion)); assertThat(registeredBeanDefinition.getName(), is(name)); }