Class SpringTestHelper
java.lang.Object
com.atlassian.bamboo.testutils.spring.SpringTestHelper
Usage of this class is only justified for TestNG tests which can't utilize the power of JUnit rules.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
To be used only in TestNG tests when SpringContextRule can't be used.static void
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.
-
Constructor Details
-
SpringTestHelper
public SpringTestHelper()
-
-
Method Details
-
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
-