Class 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 Detail

      • SpringTestHelper

        public SpringTestHelper()
    • Method Detail

      • mockContainerContext

        public static void mockContainerContext()
        To be used only in TestNG tests when SpringContextRule can't be used. Caller is responsible for calling cleanContainerContext().
      • 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 component
        componentClass - 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 component
        componentInstance - component itself