java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.metrics.common.util.TimeUtils

public class TimeUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.hamcrest.Matcher<Long>
    approxMillis(long originalMillis)
    Check that a nanosecond time is within 20% of an expected time in milliseconds
    static org.hamcrest.Matcher<Double>
    approxMillisFromSeconds(long originalMillis)
    Check that a floating point time in seconds is within 20% of an expected time in milliseconds
    static org.hamcrest.Matcher<Long>
    lessThanMillis(long originalMillis)
    Check that a nanosecond time is less than an expected time in milliseconds

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • approxMillis

      public static org.hamcrest.Matcher<Long> approxMillis(long originalMillis)
      Check that a nanosecond time is within 20% of an expected time in milliseconds

      Note that this method applies any timeout scaling configured in TCKConfig, does the millseconds to nanoseconds conversion and creates a Matcher to do the check.

      Useful for checking the results from Histograms.

      Parameters:
      originalMillis - the expected time in milliseconds
      Returns:
      a Matcher which matches against a time in nanoseconds
    • approxMillisFromSeconds

      public static org.hamcrest.Matcher<Double> approxMillisFromSeconds(long originalMillis)
      Check that a floating point time in seconds is within 20% of an expected time in milliseconds

      Note that this method applies any timeout scaling configured in TCKConfig, does the millseconds to nanoseconds conversion and creates a Matcher to do the check.

      Useful for checking the results from Telemetry Histograms.

      Parameters:
      originalMillis - the expected time in milliseconds
      Returns:
      a Matcher which matches against a time in seconds
    • lessThanMillis

      public static org.hamcrest.Matcher<Long> lessThanMillis(long originalMillis)
      Check that a nanosecond time is less than an expected time in milliseconds

      This method applies any timeout scaling configured in TCKConfig, does the millseconds to nanoseconds conversion and creates a Matcher to do the check.

      Useful for checking the results from Histograms.

      Parameters:
      originalMillis - the expected time in milliseconds
      Returns:
      a Matcher which matches against a time in nanoseconds