net.jqwik.spring.JupiterExtensionContextAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jqwik-spring Show documentation
Show all versions of jqwik-spring Show documentation
Jqwik Spring support module
The newest version!
package net.jqwik.spring;
import java.lang.reflect.*;
import java.util.*;
import java.util.function.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.*;
import org.junit.jupiter.api.parallel.*;
import net.jqwik.api.lifecycle.*;
class JupiterExtensionContextAdapter implements ExtensionContext {
private final LifecycleContext context;
JupiterExtensionContextAdapter(LifecycleContext context) {
this.context = context;
}
@Override
public Optional getParent() {
return Optional.empty();
}
@Override
public ExtensionContext getRoot() {
// Used in expression evaluation to get store
return this;
}
@Override
public String getUniqueId() {
throw new UnsupportedOperationException();
}
@Override
public String getDisplayName() {
return context.label();
}
@Override
public Set getTags() {
throw new UnsupportedOperationException();
}
@Override
public Optional getElement() {
if (context instanceof PropertyLifecycleContext) {
return Optional.of(((PropertyLifecycleContext) context).targetMethod());
}
if (context instanceof TryLifecycleContext) {
return Optional.of(((TryLifecycleContext) context).targetMethod());
}
return context.optionalElement();
}
@Override
public Optional> getTestClass() {
return context.optionalContainerClass();
}
@Override
public Optional getTestInstanceLifecycle() {
return Optional.empty();
}
@Override
public Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy