クラス SourceFile

java.lang.ObjectSE
org.springframework.core.test.tools.DynamicFile
org.springframework.core.test.tools.SourceFile
実装されたすべてのインターフェース:
org.assertj.core.api.AssertProvider<SourceFileAssert>

public final class SourceFile extends DynamicFile implements org.assertj.core.api.AssertProvider<SourceFileAssert>
Java ソースコードを保持し、SourceFileAssert サポートを提供する DynamicFile。通常、AOT で生成された型から作成されます。例:
 SourceFile.of(generatedFile::writeTo)
 
導入:
6.0
作成者:
Phillip Webb, Scott Frederick
  • メソッドの詳細

    • forTestClass

      public static SourceFile forTestClass(ClassSE<?> type)
      指定されたテスト Class のソースを検索して、新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      type - ソースを取得するクラスファイル
      戻り値:
      SourceFile インスタンス
    • forClass

      public static SourceFile forClass(FileSE sourceDirectory, ClassSE<?> type)
      指定された Class のソースを検索して新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      sourceDirectory - ソースディレクトリ
      type - ソースを取得するクラスファイル
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(CharSequenceSE charSequence)
      指定された CharSequenceSE から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      charSequence - ソースの内容を含むファイル
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(@Nullable StringSE path, CharSequenceSE charSequence)
      指定された CharSequenceSE から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      path - 推定されるパスを持つファイルまたは null の相対パス
      charSequence - ソースの内容を含むファイル
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(InputStreamSource inputStreamSource)
      指定された InputStreamSource から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      inputStreamSource - ファイルのソース
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(@Nullable StringSE path, InputStreamSource inputStreamSource)
      指定された InputStreamSource から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      path - 推定されるパスを持つファイルまたは null の相対パス
      inputStreamSource - ファイルのソース
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(WritableContent writableContent)
      指定された WritableContent から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      writableContent - ファイルに書き込む内容
      戻り値:
      SourceFile インスタンス
    • of

      public static SourceFile of(@Nullable StringSE path, WritableContent writableContent)
      指定された WritableContent から新しい SourceFile を作成するファクトリメソッド。
      パラメーター:
      path - 推定されるパスを持つファイルまたは null の相対パス
      writableContent - ファイルに書き込む内容
      戻り値:
      SourceFile インスタンス
    • getClassName

      public StringSE getClassName()
      完全修飾クラス名を返します。
      戻り値:
      完全修飾クラス名
    • assertThat

      public SourceFileAssert assertThat()
      このメソッドを直接呼び出すのではなく、assertThat(sourceFile) を使用してください。
      次で指定:
      インターフェース org.assertj.core.api.AssertProvider<SourceFileAssert>assertThat