Class TrackerConfig

java.lang.Object
ru.vyarus.dropwizard.guice.test.track.TrackerConfig

public class TrackerConfig extends Object
Tracker configuration.
Since:
30.04.2025
  • Constructor Details

    • TrackerConfig

      public TrackerConfig()
  • Method Details

    • 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 ChronoUnit getSlowMethodsUnit()
      Unit for getSlowMethods() threshold value (seconds by default).
      Returns:
      unit for threshold value
    • setSlowMethodsUnit

      public void setSlowMethodsUnit(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