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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidTo be used only in TestNG tests when SpringContextRule can't be used.static voidTo be used only in TestNG tests when SpringContextRule can't be used.static <T> TmockSpringComponent(@NotNull String componentKey, @NotNull Class<T> componentClass) Mock a component that could be accessed by ComponentAccessor or ContainerManager.static voidmockSpringComponent(@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
-