Package generic.test

Class TestThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class TestThread
    extends java.lang.Thread
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NAME_PREFIX  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.StackTraceElement[] filterTrace​(java.lang.StackTraceElement[] trace)
      Filters the given stack trace to remove entries known to be present in the test thread that offer little forensic value
      static boolean isTestThread()
      Returns true if the current thread is the test thread
      static boolean isTestThread​(java.lang.Thread t)
      Returns true if the given thread is the test thread
      static boolean isTestThreadName​(java.lang.String name)
      Returns true if the given thread name is the test thread name
      void run()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • isTestThread

        public static boolean isTestThread()
        Returns true if the current thread is the test thread
        Returns:
        true if the current thread is the test thread
      • isTestThread

        public static boolean isTestThread​(java.lang.Thread t)
        Returns true if the given thread is the test thread
        Parameters:
        t - the thread to check
        Returns:
        true if the given thread is the test thread
      • isTestThreadName

        public static boolean isTestThreadName​(java.lang.String name)
        Returns true if the given thread name is the test thread name
        Parameters:
        name - the thread name to check
        Returns:
        true if the given thread name is the test thread name
      • filterTrace

        public static java.lang.StackTraceElement[] filterTrace​(java.lang.StackTraceElement[] trace)
        Filters the given stack trace to remove entries known to be present in the test thread that offer little forensic value
        Parameters:
        trace - the trace to filter
        Returns:
        the filtered trace
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread