Move TestCompiler and related classes to core.test.tools package
Closes gh-29175
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Support classes for running assertions on generated files.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
package org.springframework.aot.test.generate.file;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -14,12 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
/**
|
||||
* Exception thrown when code cannot compile.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@@ -14,17 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -29,10 +29,6 @@ import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ClassFile;
|
||||
import org.springframework.aot.test.generate.file.ClassFiles;
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.assertj.core.api.AbstractAssert;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -30,10 +30,6 @@ import javax.tools.JavaFileManager;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.JavaFileObject.Kind;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ClassFile;
|
||||
import org.springframework.aot.test.generate.file.ClassFiles;
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
@@ -14,15 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.SimpleJavaFileObject;
|
||||
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
|
||||
/**
|
||||
* Adapts a {@link SourceFile} instance to a {@link JavaFileObject}.
|
||||
*
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
/**
|
||||
* Assertion methods for {@code ResourceFile} instances.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
/**
|
||||
* Assertion methods for {@code SourceFile} instances.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -35,13 +35,6 @@ import javax.tools.ToolProvider;
|
||||
|
||||
import org.springframework.aot.generate.GeneratedFiles.Kind;
|
||||
import org.springframework.aot.generate.InMemoryGeneratedFiles;
|
||||
import org.springframework.aot.test.generate.file.ClassFile;
|
||||
import org.springframework.aot.test.generate.file.ClassFiles;
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
import org.springframework.aot.test.generate.file.WritableContent;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -14,16 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* Tests for {@link CompilationException}.
|
||||
*
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -22,11 +22,6 @@ import java.util.function.Supplier;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -31,10 +31,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ClassFile;
|
||||
import org.springframework.aot.test.generate.file.ClassFiles;
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -14,12 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -88,15 +88,15 @@ class SourceFileTests {
|
||||
@Test
|
||||
void forClassWithClassUsesClass() {
|
||||
SourceFile sourceFile = SourceFile.forClass(new File("src/test/java"), SourceFileTests.class);
|
||||
assertThat(sourceFile.getPath()).isEqualTo("org/springframework/aot/test/generate/file/SourceFileTests.java");
|
||||
assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.aot.test.generate.file.SourceFileTests");
|
||||
assertThat(sourceFile.getPath()).isEqualTo("org/springframework/core/test/tools/SourceFileTests.java");
|
||||
assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.core.test.tools.SourceFileTests");
|
||||
}
|
||||
|
||||
@Test
|
||||
void forTestClassWithClassUsesClass() {
|
||||
SourceFile sourceFile = SourceFile.forTestClass(SourceFileTests.class);
|
||||
assertThat(sourceFile.getPath()).isEqualTo("org/springframework/aot/test/generate/file/SourceFileTests.java");
|
||||
assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.aot.test.generate.file.SourceFileTests");
|
||||
assertThat(sourceFile.getPath()).isEqualTo("org/springframework/core/test/tools/SourceFileTests.java");
|
||||
assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.core.test.tools.SourceFileTests");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.file;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aot.test.generate.compile;
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -30,12 +30,6 @@ import javax.lang.model.element.TypeElement;
|
||||
import com.example.PublicInterface;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.test.generate.file.ClassFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFile;
|
||||
import org.springframework.aot.test.generate.file.ResourceFiles;
|
||||
import org.springframework.aot.test.generate.file.SourceFile;
|
||||
import org.springframework.aot.test.generate.file.SourceFiles;
|
||||
import org.springframework.aot.test.generate.file.WritableContent;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
Reference in New Issue
Block a user