Port the build to Gradle

Closes gh-19609
Closes gh-19608
This commit is contained in:
Andy Wilkinson
2020-01-10 13:48:43 +00:00
parent abe95fa8a7
commit ce99db1902
974 changed files with 17108 additions and 26596 deletions

View File

@@ -100,11 +100,12 @@ class FileSystemWatcherTests {
}
@Test
void sourceFolderMustNotBeAFile() {
File folder = new File("pom.xml");
assertThat(folder.isFile()).isTrue();
assertThatIllegalArgumentException().isThrownBy(() -> this.watcher.addSourceFolder(new File("pom.xml")))
.withMessageContaining("Folder 'pom.xml' must not be a file");
void sourceFolderMustNotBeAFile() throws IOException {
File file = new File(this.tempDir, "file");
assertThat(file.createNewFile()).isTrue();
assertThat(file.isFile()).isTrue();
assertThatIllegalArgumentException().isThrownBy(() -> this.watcher.addSourceFolder(file))
.withMessageContaining("Folder '" + file + "' must not be a file");
}
@Test

View File

@@ -104,7 +104,7 @@ class ChangeableUrlsTests {
private URL makeUrl(String name) throws IOException {
File file = new File(this.tempDir, UUID.randomUUID().toString());
file = new File(file, name);
file = new File(file, "target");
file = new File(file, "build");
file = new File(file, "classes");
file.mkdirs();
return file.toURI().toURL();

View File

@@ -16,6 +16,10 @@
package org.springframework.boot.devtools.restart;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -82,8 +86,17 @@ class DefaultRestartInitializerTests {
}
@Test
void urlsCanBeRetrieved() {
assertThat(new DefaultRestartInitializer().getUrls(Thread.currentThread())).isNotEmpty();
void urlsCanBeRetrieved() throws IOException {
Thread thread = Thread.currentThread();
ClassLoader classLoader = thread.getContextClassLoader();
try (URLClassLoader contextClassLoader = new URLClassLoader(
new URL[] { new URL("file:test-app/build/classes/main/") }, classLoader)) {
thread.setContextClassLoader(contextClassLoader);
assertThat(new DefaultRestartInitializer().getUrls(thread)).isNotEmpty();
}
finally {
thread.setContextClassLoader(classLoader);
}
}
protected void testSkippedStacks(String s) {

View File

@@ -62,7 +62,7 @@ class DevToolsSettingsTests {
private URL makeUrl(File file, String name) throws IOException {
file = new File(file, name);
file = new File(file, "target");
file = new File(file, "build");
file = new File(file, "classes");
file.mkdirs();
return file.toURI().toURL();