org.junit.jupiter.api.extension.TestInstancePostProcessor Java Examples
The following examples show how to use
org.junit.jupiter.api.extension.TestInstancePostProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PerfConfigContext.java From junitperf with Apache License 2.0 | 5 votes |
@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); } } ); }
Example #2
Source File: DualPlannerExtension.java From fdb-record-layer with Apache License 2.0 | 4 votes |
public DualPlannerTestInvocationContext(boolean useRewritePlanner, List<Extension> extensions) { this.extensions = new ArrayList<>(extensions); this.extensions.add((TestInstancePostProcessor) (testInstance, context) -> ((FDBRecordStoreQueryTestBase) testInstance).setUseRewritePlanner(useRewritePlanner)); }