Class SpringTestHelper
- java.lang.Object
-
- com.atlassian.bamboo.testutils.spring.SpringTestHelper
-
public class SpringTestHelper extends Object
Usage of this class is only justified for TestNG tests which can't utilize the power of JUnit rules.
-
-
Constructor Summary
Constructors Constructor Description SpringTestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanContainerContext()
To be used only in TestNG tests when SpringContextRule can't be used.static void
mockContainerContext()
To be used only in TestNG tests when SpringContextRule can't be used.static <T> T
mockSpringComponent(@NotNull String componentKey, @NotNull Class<T> componentClass)
Mock a component that could be accessed by ComponentAccessor or ContainerManager.static void
mockSpringComponent(@NotNull String componentKey, @Nullable Object componentInstance)
Mock a component that could be accessed by ComponentAccessor or ContainerManager.
-
-
-
Method Detail
-
mockContainerContext
public static void mockContainerContext()
To be used only in TestNG tests when SpringContextRule can't be used. Caller is responsible for callingcleanContainerContext()
.
-
cleanContainerContext
public static void cleanContainerContext()
To be used only in TestNG tests when SpringContextRule can't be used.
-
mockSpringComponent
public static <T> T mockSpringComponent(@NotNull @NotNull String componentKey, @NotNull @NotNull Class<T> componentClass)
Mock a component that could be accessed by ComponentAccessor or ContainerManager.- Parameters:
componentKey
- key of the componentcomponentClass
- class of component
-
mockSpringComponent
public static void mockSpringComponent(@NotNull @NotNull String componentKey, @Nullable @Nullable Object componentInstance)
Mock a component that could be accessed by ComponentAccessor or ContainerManager.- Parameters:
componentKey
- key of the componentcomponentInstance
- component itself
-
-