Class TestBeanContainer

    • Constructor Detail

      • TestBeanContainer

        public TestBeanContainer()
    • Method Detail

      • getMockedBeanContainer

        public static BeanContainer getMockedBeanContainer()
      • getBeanByName

        public <T> T getBeanByName​(String name)
        Description copied from interface: BeanContainer
        Gets a bean managed in this container by its name. If no such bean exists in the bean container, then an IllegalStateException exception is thrown.
        Specified by:
        getBeanByName in interface BeanContainer
        Type Parameters:
        T - the type of the bean to return.
        Parameters:
        name - the name of the bean.
        Returns:
        the bean matching the specified name.
      • getBeanByType

        public <T> T getBeanByType​(Class<T> type,
                                   Annotation... qualifiers)
        Description copied from interface: BeanContainer
        Gets a bean managed in this container by its type and optionally by some qualifiers. If no such bean exists in the bean container, then an IllegalStateException exception is thrown.
        Specified by:
        getBeanByType in interface BeanContainer
        Type Parameters:
        T - the type of the bean to return.
        Parameters:
        type - the type of the bean.
        qualifiers - zero, one or more qualifiers annotating the bean to look for.
        Returns:
        the bean satisfying the expected type and, if any, the expected qualifiers.
      • getAllBeansByType

        public <T> Set<T> getAllBeansByType​(Class<T> type,
                                            Annotation... qualifiers)
        Description copied from interface: BeanContainer
        Gets a bean managed in this container by its name. If no such bean exists in the bean container, then an empty set is returned.
        Specified by:
        getAllBeansByType in interface BeanContainer
        Type Parameters:
        T - the type of the bean to return.
        Parameters:
        type - the type of the bean.
        qualifiers - zero, one or more qualifiers annotating the bean to look for.
        Returns:
        a set of beans satisfying the expected type and, if any, the expected qualifiers, or an empty set otherwise.