org.junit.rules.Stopwatch源码实例Demo

类org.junit.rules.Stopwatch源码实例Demo

下面列出了org.junit.rules.Stopwatch 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public static ResultMatcher executionTimeLessThan(Stopwatch stopwatch, long expectedTimeMs) {
    return mvcResult -> {
        long time = stopwatch.runtime(TimeUnit.MILLISECONDS);
        System.out.println("Execution time: " + time + "ms");
        assertThat(time).isLessThanOrEqualTo(expectedTimeMs);
    };
}