Class ObjectBag

java.lang.Object
org.testng.internal.ObjectBag

public final class ObjectBag extends Object
A simple bean bag that is intended to help share objects during the lifetime of TestNG without needing it to be a singleton.
  • Constructor Details

    • ObjectBag

      public ObjectBag()
  • Method Details

    • getInstance

      public static ObjectBag getInstance(ISuite suite)
    • getInstance

      public static ObjectBag getInstance(XmlSuite xmlSuite)
    • cleanup

      public static void cleanup(ISuite suite)
    • createIfRequired

      public Object createIfRequired(Class<?> type, Supplier<Object> supplier)
      Parameters:
      type - - The type of the object to be created
      supplier - - A Supplier that should be used to produce a new instance
      Returns:
      - Either the newly produced instance or the existing instance.
    • cleanup

      public void cleanup()