This commit is contained in:
Stephane Nicoll
2019-12-26 10:42:40 +01:00
parent 1e38dd5531
commit 2c1e81adf0
24 changed files with 65 additions and 78 deletions

View File

@@ -172,9 +172,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
MergedAnnotations annotations = MergedAnnotations.from(testClass,
MergedAnnotations.SearchStrategy.TYPE_HIERARCHY);
ClassPathEntryFilter filter = new ClassPathEntryFilter(annotations.get(ClassPathExclusions.class));
List<URL> processedUrls = new ArrayList<>();
List<URL> additionalUrls = getAdditionalUrls(annotations.get(ClassPathOverrides.class));
processedUrls.addAll(additionalUrls);
List<URL> processedUrls = new ArrayList<>(additionalUrls);
for (URL url : urls) {
if (!filter.isExcluded(url)) {
processedUrls.add(url);

View File

@@ -81,7 +81,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
}
private void runTestWithModifiedClassPath(ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) throws ClassNotFoundException, Throwable {
ExtensionContext extensionContext) throws Throwable {
Class<?> testClass = extensionContext.getRequiredTestClass();
Method testMethod = invocationContext.getExecutable();
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
@@ -95,8 +95,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
}
}
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName)
throws ClassNotFoundException, Throwable {
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName) throws Throwable {
Class<?> testClass = classLoader.loadClass(testClassName);
Method testMethod = findMethod(testClass, testMethodName);
LauncherDiscoveryRequest request = new LauncherDiscoveryRequestBuilder(classLoader)

View File

@@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import javax.annotation.processing.Processor;
import javax.tools.JavaCompiler;
@@ -59,7 +60,7 @@ public class TestCompiler {
this.fileManager = compiler.getStandardFileManager(null, null, null);
this.outputLocation = outputLocation;
this.outputLocation.mkdirs();
Iterable<? extends File> temp = Arrays.asList(this.outputLocation);
Iterable<? extends File> temp = Collections.singletonList(this.outputLocation);
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, temp);
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, temp);
}