All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.engine.execution.DefaultTryLifecycleContext Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
package net.jqwik.engine.execution;

import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;
import java.util.function.*;

import net.jqwik.api.*;
import net.jqwik.api.lifecycle.*;

import static net.jqwik.engine.execution.LifecycleContextSupport.*;

public class DefaultTryLifecycleContext implements TryLifecycleContext {
	private final PropertyLifecycleContext propertyContext;

	public DefaultTryLifecycleContext(PropertyLifecycleContext propertyContext) {
		this.propertyContext = propertyContext;
	}

	@Override
	public Method targetMethod() {
		return propertyContext.targetMethod();
	}

	@Override
	public Class containerClass() {
		return propertyContext.containerClass();
	}

	@Override
	public Object testInstance() {
		return propertyContext.testInstance();
	}

	@Override
	public List testInstances() {
		return propertyContext.testInstances();
	}

	@Override
	public String label() {
		return propertyContext.label();
	}

	@Override
	public Optional optionalElement() {
		return propertyContext.optionalElement();
	}

	@Override
	public Optional> optionalContainerClass() {
		return Optional.of(propertyContext.containerClass());
	}

	@Override
	public Reporter reporter() {
		return propertyContext.reporter();
	}

	@Override
	public void wrapReporter(Function wrapper) {
		propertyContext.wrapReporter(wrapper);
	}

	@Override
	public  T newInstance(Class clazz) {
		return propertyContext.newInstance(clazz);
	}

	@Override
	public Optional resolveParameter(Executable executable, int index) {
		return propertyContext.resolveParameter(executable, index);
	}

	@Override
	public  Optional findAnnotation(Class annotationClass) {
		return propertyContext.findAnnotation(annotationClass);
	}

	@Override
	public  List findAnnotationsInContainer(Class annotationClass) {
		return propertyContext.findAnnotationsInContainer(annotationClass);
	}

	@Override
	public  List findRepeatableAnnotations(Class annotationClass) {
		return propertyContext.findRepeatableAnnotations(annotationClass);
	}

	@Override
	public String toString() {
		return String.format("TryLifecycleContext:%s", propertyContext);
	}
}