Java 类org.junit.jupiter.api.extension.ContainerExtensionContext 实例源码
项目:demo-junit-5
文件:BenchmarkExtension.java
@Override
public void beforeAll(ContainerExtensionContext context) {
if (!shouldBeBenchmarked(context))
return;
storeNowAsLaunchTime(context, LaunchTimeKey.CLASS);
}
项目:demo-junit-5
文件:BenchmarkExtension.java
@Override
public void afterAll(ContainerExtensionContext context) {
if (!shouldBeBenchmarked(context))
return;
long launchTime = loadLaunchTime(context, LaunchTimeKey.CLASS);
long elapsedTime = currentTimeMillis() - launchTime;
report("Test container", context, elapsedTime);
}
项目:demo-junit-5
文件:CollectExceptionExtension.java
private static Optional<ExtensionContext> getAncestorContainerContext(ExtensionContext context) {
Optional<ExtensionContext> containerContext = Optional.of(context);
while (containerContext.isPresent()
&& !(containerContext.get() instanceof ContainerExtensionContext))
containerContext = containerContext.get().getParent();
return containerContext;
}
项目:demo-junit-5
文件:CustomArgumentsSourceTest.java
@Override
public Stream<? extends Arguments> arguments(ContainerExtensionContext context) {
return new Random()
.ints(0, 10)
.mapToObj(ObjectArrayArguments::create)
.limit(3);
}
项目:vaadin-016-helloworld-14
文件:PageObjectExtension.java
@Override
// public void beforeAll(ExtensionContext context) throws Exception {
public void beforeAll(ContainerExtensionContext context) throws Exception {
System.setProperty(KEY_VAADIN_SERVER_IP, ipSupplierLocalIP.get());
}
项目:demo-junit-5
文件:DisabledCondition.java
@Override
public ConditionEvaluationResult evaluate(ContainerExtensionContext context) {
return evaluateIfAnnotated(context.getElement());
}
项目:demo-junit-5
文件:OsCondition.java
@Override
public ConditionEvaluationResult evaluate(ContainerExtensionContext context) {
return evaluateIfAnnotated(context.getElement());
}
项目:webtester2-factsheet
文件:EmbeddedApplication.java
@Override
public void beforeAll(ContainerExtensionContext context) throws Exception {
ConfigurableApplicationContext application = Application.start();
context.getStore(NAMESPACE).put("application", application);
}
项目:webtester2-factsheet
文件:EmbeddedApplication.java
@Override
public void afterAll(ContainerExtensionContext context) throws Exception {
context.getStore(NAMESPACE).get("application", ConfigurableApplicationContext.class).stop();
}