parent
3d650e4ccf
commit
b60194441e
|
@ -13,7 +13,7 @@ graalVersion=22.3
|
|||
hamcrestVersion=3.0
|
||||
jacksonVersion=2.18.3
|
||||
javaFormatVersion=0.0.43
|
||||
junitJupiterVersion=5.11.4
|
||||
junitJupiterVersion=5.12.1
|
||||
kotlinVersion=1.9.25
|
||||
mavenVersion=3.9.4
|
||||
mockitoVersion=5.16.0
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.junit.jupiter.api.extension.ParameterContext;
|
|||
import org.junit.jupiter.api.extension.ParameterResolutionException;
|
||||
import org.junit.jupiter.api.extension.ParameterResolver;
|
||||
import org.junit.platform.commons.support.AnnotationSupport;
|
||||
import org.junit.platform.commons.support.SearchOption;
|
||||
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
|
@ -66,7 +65,7 @@ class ResourcesExtension implements BeforeEachCallback, AfterEachCallback, Param
|
|||
resourcesOf(testMethod)
|
||||
.forEach((resource) -> resources.addResource(resource.name(), resource.content(), resource.additional()));
|
||||
resourceDirectoriesOf(testMethod).forEach((directory) -> resources.addDirectory(directory.value()));
|
||||
packageResourcesOf(testMethod).forEach((withPackageResources) -> resources
|
||||
packageResourcesOf(testMethod, context).forEach((withPackageResources) -> resources
|
||||
.addPackage(testMethod.getDeclaringClass().getPackage(), withPackageResources.value()));
|
||||
ResourcesClassLoader classLoader = new ResourcesClassLoader(context.getRequiredTestClass().getClassLoader(),
|
||||
resources);
|
||||
|
@ -93,12 +92,11 @@ class ResourcesExtension implements BeforeEachCallback, AfterEachCallback, Param
|
|||
return annotations;
|
||||
}
|
||||
|
||||
private List<WithPackageResources> packageResourcesOf(Method method) {
|
||||
private List<WithPackageResources> packageResourcesOf(Method method, ExtensionContext context) {
|
||||
List<WithPackageResources> annotations = new ArrayList<>();
|
||||
AnnotationSupport.findAnnotation(method, WithPackageResources.class).ifPresent(annotations::add);
|
||||
AnnotationSupport
|
||||
.findAnnotation(method.getDeclaringClass(), WithPackageResources.class,
|
||||
SearchOption.INCLUDE_ENCLOSING_CLASSES)
|
||||
.findAnnotation(method.getDeclaringClass(), WithPackageResources.class, context.getEnclosingTestClasses())
|
||||
.ifPresent(annotations::add);
|
||||
return annotations;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ dependencies {
|
|||
testImplementation("org.assertj:assertj-core")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testImplementation("org.springframework:spring-core")
|
||||
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
task syncTestRepository(type: Sync) {
|
||||
|
|
Loading…
Reference in New Issue