Move TestCompiler and related classes to core.test.tools package

Closes gh-29175
This commit is contained in:
Phillip Webb
2022-09-19 21:54:04 -07:00
parent c9009453c9
commit 52bffbff76
54 changed files with 76 additions and 132 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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}.
*

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
/**

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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;