net.jqwik.spring.AroundSpringTestContainer 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
package net.jqwik.spring;
import java.lang.reflect.*;
import java.util.*;
import net.jqwik.api.lifecycle.*;
class AroundSpringTestContainer implements BeforeContainerHook, AfterContainerHook {
@Override
public boolean appliesTo(Optional optionalElement) {
// Only apply to container classes
return optionalElement.map(element -> element instanceof Class).orElse(false);
}
@Override
public void beforeContainer(ContainerLifecycleContext context) throws Exception {
Optional> optionalContainerClass = context.optionalContainerClass();
if (optionalContainerClass.isPresent()) {
JqwikSpringExtension.getTestContextManager(optionalContainerClass.get()).beforeTestClass();
}
}
@Override
public void afterContainer(ContainerLifecycleContext context) throws Exception {
Optional> optionalContainerClass = context.optionalContainerClass();
if (optionalContainerClass.isPresent()) {
JqwikSpringExtension.getTestContextManager(optionalContainerClass.get()).afterTestClass();
}
}
@Override
public int beforeContainerProximity() {
return -20;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy