Package org.silverpeas.core.test
Class TestBeanContainer
- java.lang.Object
-
- org.silverpeas.core.test.TestBeanContainer
-
- All Implemented Interfaces:
BeanContainer
public class TestBeanContainer extends Object implements BeanContainer
- Author:
- Yohann Chastagnier
-
-
Constructor Summary
Constructors Constructor Description TestBeanContainer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Set<T>
getAllBeansByType(Class<T> type, Annotation... qualifiers)
Gets a bean managed in this container by its name.<T> T
getBeanByName(String name)
Gets a bean managed in this container by its name.<T> T
getBeanByType(Class<T> type, Annotation... qualifiers)
Gets a bean managed in this container by its type and optionally by some qualifiers.static BeanContainer
getMockedBeanContainer()
-
-
-
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 interfaceBeanContainer
- 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 interfaceBeanContainer
- 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 interfaceBeanContainer
- 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.
-
-