Class TestResourceTracker


  • public class TestResourceTracker
    extends Object
    Keeps track of resources created by tests and cleans them up at the end of the test.
    Since:
    7.0
    Author:
    Dan Berindei
    • Constructor Detail

      • TestResourceTracker

        public TestResourceTracker()
    • Method Detail

      • addResource

        public static void addResource​(TestResourceTracker.Cleaner<?> cleaner)
        Add a resource to the current thread's running test.
      • cleanUpResources

        public static void cleanUpResources​(String testName)
      • getCurrentTestShortName

        public static String getCurrentTestShortName()
      • getCurrentTestName

        public static String getCurrentTestName()
      • testStarted

        public static void testStarted​(String testName)
        Called on the "main" test thread, before any configuration method.
      • testFinished

        public static void testFinished​(String testName)
        Called on the "main" test thread, after any configuration method.
      • testThreadStarted

        public static void testThreadStarted​(String testName)
        Should be called by the user on any "background" test thread that creates resources, e.g. at the beginning of a test with a @Test(timeout=n) annotation.
        Parameters:
        testName -
      • setThreadTestName

        public static void setThreadTestName​(String testName)
      • setThreadTestNameIfMissing

        public static void setThreadTestNameIfMissing​(String testName)
      • getNextNodeName

        public static String getNextNodeName()
      • getNextTestThreadName

        public static String getNextTestThreadName()
      • getNameForIndex

        public static String getNameForIndex​(int i)