Class SourceFile
java.lang.Object
org.springframework.aot.test.generate.file.DynamicFile
org.springframework.aot.test.generate.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 fully-qualified class name.static SourceFile
of
(CharSequence charSequence) Factory method to create a newSourceFile
from the givenCharSequence
.static SourceFile
of
(String path, CharSequence charSequence) Factory method to create a newSourceFile
from the givenCharSequence
.static SourceFile
of
(String path, WritableContent writableContent) Factory method to create a newSourceFile
from the givenWritableContent
.static SourceFile
of
(String path, InputStreamSource inputStreamSource) Factory method to create a newSourceFile
from the givenInputStreamSource
.static SourceFile
of
(WritableContent writableContent) Factory method to create a newSourceFile
from the givenWritableContent
.static SourceFile
of
(InputStreamSource inputStreamSource) Factory method to create a newSourceFile
from the givenInputStreamSource
.Methods inherited from class org.springframework.aot.test.generate.file.DynamicFile
equals, getContent, getPath, hashCode, toString, toString
-
Method Details
-
of
Factory method to create a newSourceFile
from the givenCharSequence
.- Parameters:
charSequence
- a file containing the source contents- Returns:
- a
SourceFile
instance
-
of
Factory method to create a newSourceFile
from the givenCharSequence
.- Parameters:
path
- the relative path of the file ornull
to have the path deducedcharSequence
- a file containing the source contents- Returns:
- a
SourceFile
instance
-
of
Factory method to create a newSourceFile
from the givenInputStreamSource
.- Parameters:
inputStreamSource
- the source for the file- Returns:
- a
SourceFile
instance
-
of
Factory method to create a newSourceFile
from the givenInputStreamSource
.- Parameters:
path
- the relative path of the file ornull
to have the path deducedinputStreamSource
- the source for the file- Returns:
- a
SourceFile
instance
-
of
Factory method to create a newSourceFile
from the givenWritableContent
.- Parameters:
writableContent
- the content to write to the file- Returns:
- a
SourceFile
instance
-
of
Factory method to create a newSourceFile
from the givenWritableContent
.- Parameters:
path
- the relative path of the file ornull
to have the path deducedwritableContent
- the content to write to the file- Returns:
- a
SourceFile
instance
-
getClassName
Return the fully-qualified class name.- Returns:
- the fully qualified class name
-
assertThat
Deprecated.useassertThat(sourceFile)
rather than calling this method directly.AssertJassertThat
support.- Specified by:
assertThat
in interfaceorg.assertj.core.api.AssertProvider<SourceFileAssert>
-
assertThat(sourceFile)
rather than calling this method directly.