public static Matcher<SpanData> hasDuration(Matcher<Duration> matcher) {
    return new FeatureMatcher<SpanData, Duration>(matcher, "SpanData having duration that ",
      "duration") {
      @Override
      protected Duration featureValueOf(SpanData item) {
        return Duration.ofNanos(item.getEndEpochNanos() - item.getStartEpochNanos());
      }
    };
  }
Helper methods for matching against instances of {@link SpanData}.
hbase-client/src/test/java/org/apache/hadoop/hbase/client/trace/hamcrest/SpanDataMatchers.java