Class SourceFile
java.lang.Object
org.springframework.aot.test.generator.file.DynamicFile
org.springframework.aot.test.generator.file.SourceFile
- All Implemented Interfaces:
org.assertj.core.api.AssertProvider<SourceFileAssert>
public final class SourceFile
extends DynamicFile
implements org.assertj.core.api.AssertProvider<SourceFileAssert>
DynamicFile that holds Java source code and provides
SourceFileAssert support. Usually created from an AOT generated type,
for example:
SourceFile.of(generatedFile::writeTo)
- Since:
- 6.0
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Return the class name of the source file.static SourceFileof(CharSequence charSequence) Factory method to create a newSourceFilefrom the givenCharSequence.static SourceFileof(String path, CharSequence charSequence) Factory method to create a newSourceFilefrom the givenCharSequence.static SourceFileof(String path, WritableContent writableContent) Factory method to create a newSourceFilefrom the givenWritableContent.static SourceFileof(String path, InputStreamSource inputStreamSource) Factory method to create a newSourceFilefrom the givenInputStreamSource.static SourceFileof(WritableContent writableContent) Factory method to create a newSourceFilefrom the givenWritableContent.static SourceFileof(InputStreamSource inputStreamSource) Factory method to create a newSourceFilefrom the givenInputStreamSource.Methods inherited from class org.springframework.aot.test.generator.file.DynamicFile
equals, getContent, getPath, hashCode, toString, toString
-
Method Details
-
of
Factory method to create a newSourceFilefrom the givenCharSequence.- Parameters:
charSequence- a file containing the source contents- Returns:
- a
SourceFileinstance
-
of
Factory method to create a newSourceFilefrom the givenCharSequence.- Parameters:
path- the relative path of the file ornullto have the path deducedcharSequence- a file containing the source contents- Returns:
- a
SourceFileinstance
-
of
Factory method to create a newSourceFilefrom the givenInputStreamSource.- Parameters:
inputStreamSource- the source for the file- Returns:
- a
SourceFileinstance
-
of
Factory method to create a newSourceFilefrom the givenInputStreamSource.- Parameters:
path- the relative path of the file ornullto have the path deducedinputStreamSource- the source for the file- Returns:
- a
SourceFileinstance
-
of
Factory method to create a newSourceFilefrom the givenWritableContent.- Parameters:
writableContent- the content to write to the file- Returns:
- a
SourceFileinstance
-
of
Factory method to create a newSourceFilefrom the givenWritableContent.- Parameters:
path- the relative path of the file ornullto have the path deducedwritableContent- the content to write to the file- Returns:
- a
SourceFileinstance
-
getClassName
Return the class name of the source file.- Returns:
- the class name
-
assertThat
Deprecated.useassertThat(sourceFile)rather than calling this method directly.AssertJassertThatsupport.- Specified by:
assertThatin interfaceorg.assertj.core.api.AssertProvider<SourceFileAssert>
-
assertThat(sourceFile)rather than calling this method directly.