org.junit.jupiter.api.extension.TestInstancePostProcessor源码实例Demo

org.junit.jupiter.api.extension.Extension#org.junit.jupiter.api.extension.TestInstancePostProcessor源码实例Demo

下面列出了org.junit.jupiter.api.extension.Extension#org.junit.jupiter.api.extension.TestInstancePostProcessor 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: junitperf   文件: PerfConfigContext.java
@Override
public List<Extension> getAdditionalExtensions() {
    return Collections.singletonList(
            (TestInstancePostProcessor) (testInstance, context) -> {
                final Class clazz = testInstance.getClass();
                // Group test contexts by test class
                ACTIVE_CONTEXTS.putIfAbsent(clazz, new ArrayList<>());

                EvaluationContext evaluationContext = new EvaluationContext(testInstance,
                        method,
                        DateUtil.getCurrentDateTimeStr());
                evaluationContext.loadConfig(perfConfig);
                evaluationContext.loadRequire(perfRequire);
                StatisticsCalculator statisticsCalculator = perfConfig.statistics().newInstance();
                Set<Reporter> reporterSet = getReporterSet();
                ACTIVE_CONTEXTS.get(clazz).add(evaluationContext);
                try {
                    new PerformanceEvaluationStatement(evaluationContext,
                            statisticsCalculator,
                            reporterSet,
                            ACTIVE_CONTEXTS.get(clazz),
                            clazz).evaluate();
                } catch (Throwable throwable) {
                    throw new JunitPerfRuntimeException(throwable);
                }
            }
    );
}
 
源代码2 项目: fdb-record-layer   文件: DualPlannerExtension.java
public DualPlannerTestInvocationContext(boolean useRewritePlanner, List<Extension> extensions) {
    this.extensions = new ArrayList<>(extensions);
    this.extensions.add((TestInstancePostProcessor) (testInstance, context) ->
            ((FDBRecordStoreQueryTestBase) testInstance).setUseRewritePlanner(useRewritePlanner));
}