Class TrackerConfig


  • public class TrackerConfig
    extends java.lang.Object
    Tracker configuration.
    Since:
    30.04.2025
    • Constructor Summary

      Constructors 
      Constructor Description
      TrackerConfig()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMaxStringLength()
      Required to keep called method toString rendering readable in case of large strings used.
      long getSlowMethods()
      Print warnings about methods executing longer than the specified threshold.
      java.time.temporal.ChronoUnit getSlowMethodsUnit()
      Unit for getSlowMethods() threshold value (seconds by default).
      boolean isKeepRawObjects()
      It is more likely that trackers would be used mostly for "call and verify" scenarios where keeping raw arguments makes perfect sense.
      boolean isTrace()
      When enabled, prints called method just after it's execution (with called arguments and returned result).
      void setKeepRawObjects​(boolean keepRawObjects)  
      void setMaxStringLength​(int maxStringLength)  
      void setSlowMethods​(long slowMethods)  
      void setSlowMethodsUnit​(java.time.temporal.ChronoUnit slowMethodsUnit)  
      void setTrace​(boolean trace)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TrackerConfig

        public TrackerConfig()
    • Method Detail

      • isTrace

        public boolean isTrace()
        When enabled, prints called method just after it's execution (with called arguments and returned result). Not enabled by default to avoid output mess in case when many methods would be called during test.
        Returns:
        true to print each method execution
      • setTrace

        public void setTrace​(boolean trace)
        Parameters:
        trace - true to print each method execution
      • getSlowMethods

        public long getSlowMethods()
        Print warnings about methods executing longer than the specified threshold. Set to 0 to disable warnings.
        Returns:
        slow method threshold (in seconds, by default - see getSlowMethodsUnit())
      • setSlowMethods

        public void setSlowMethods​(long slowMethods)
        Parameters:
        slowMethods - slow method threshold (in seconds, by default - see getSlowMethodsUnit())
      • getSlowMethodsUnit

        public java.time.temporal.ChronoUnit getSlowMethodsUnit()
        Unit for getSlowMethods() threshold value (seconds by default).
        Returns:
        unit for threshold value
      • setSlowMethodsUnit

        public void setSlowMethodsUnit​(java.time.temporal.ChronoUnit slowMethodsUnit)
        Parameters:
        slowMethodsUnit - unit for threshold value
      • isKeepRawObjects

        public boolean isKeepRawObjects()
        It is more likely that trackers would be used mostly for "call and verify" scenarios where keeping raw arguments makes perfect sense. That's why it's enabled by default.

        Important: method arguments and the result objects state could be mutable and change after or during method execution (and so be irrelevant for tracks analysis). For such cases, the tracker always holds string representations of method arguments and the result (rendered in method execution time).

        It makes sense to disable option if too many method executions appear during the test (e.g., tracker used for performance metrics).

        Returns:
        true to keep raw arguments and result objects
      • setKeepRawObjects

        public void setKeepRawObjects​(boolean keepRawObjects)
        Parameters:
        keepRawObjects - true to keep raw arguments and result objects
      • getMaxStringLength

        public int getMaxStringLength()
        Required to keep called method toString rendering readable in case of large strings used. Note that for non-string objects, an object type with identity hash would be shown (not rely on toString because it would be too much unpredictable).
        Returns:
        maximum length of string in method parameter or returned result
      • setMaxStringLength

        public void setMaxStringLength​(int maxStringLength)
        Parameters:
        maxStringLength - maximum length of string in method parameter or returned result