org.seasar.aptina.unit
クラス AptinaTestCase

java.lang.Object
  上位を拡張 junit.framework.Assert
      上位を拡張 junit.framework.TestCase
          上位を拡張 org.seasar.aptina.unit.AptinaTestCase
すべての実装されたインタフェース:
Test

public abstract class AptinaTestCase
extends TestCase

Processor をテストするための抽象クラスです.

サブクラスのテストメソッドでは,コンパイルオプションやコンパイル対象などを設定して compile() メソッドを呼び出します. コンパイル後に生成されたソースの検証などを行うことができます.

compile() 前に以下のメソッドを呼び出すことができます (TestCase.setUp()から呼び出すこともできます).
compile() 後に以下のメソッドを呼び出して情報を取得することができます.
compile() 後に以下のメソッドを呼び出して生成されたソースの内容を検証することができます.

compile() を呼び出した後に状態をリセットしてコンパイル前の状態に戻すには, reset() を呼び出します.

次のサンプルは, src/test/java フォルダにある TestSource.java をコンパイルすると, foo.bar.Baz クラスのソースを生成する TestProcessor のテストクラスです.

 public class TestProcessorTest extends AptinaTestCase {

     @Override
     protected void setUp() throws Exception {
         super.setUp();
         // ソースパスを追加
         addSourcePath("src/test/java");
     }

     public void test() throws Exception {
         // テスト対象の Annotation Processor を生成して追加
         TestProcessor processor = new TestProcessor();
         addProcessor(processor);

         // コンパイル対象を追加
         addCompilationUnit(TestSource.class);

         // コンパイル実行
         compile();

         // テスト対象の Annotation Processor が生成したソースを検証
         assertEqualsGeneratedSource("package foo.bar; public class Baz {}",
                 "foo.bar.Baz");
     }
 
 }
 

作成者:
koichik

コンストラクタの概要
protected AptinaTestCase()
          インスタンスを構築します.
protected AptinaTestCase(String name)
          インスタンスを構築します.
 
メソッドの概要
protected  void addCompilationUnit(Class<?> clazz)
          コンパイル対象のクラスを追加します.
protected  void addCompilationUnit(Class<?> clazz, CharSequence source)
          コンパイル対象のクラスをソースとともに追加します.
protected  void addCompilationUnit(String className)
          コンパイル対象のクラスを追加します.
protected  void addCompilationUnit(String className, CharSequence source)
          コンパイル対象のクラスをソースとともに追加します.
protected  void addOption(String... options)
          コンパイラオプションを追加します.
protected  void addProcessor(Processor... processors)
          注釈を処理するProcessorを追加します.
protected  void addSourcePath(File... sourcePaths)
          コンパイル時に参照するソースパスを追加します.
protected  void addSourcePath(String... sourcePaths)
          コンパイル時に参照するソースパスを追加します.
protected  void assertEqualsByLine(BufferedReader expectedReader, BufferedReader actualReader)
          文字列を行単位で比較します.
protected  void assertEqualsByLine(String expected, String actual)
          文字列を行単位で比較します.
protected  void assertEqualsGeneratedSource(CharSequence expected, Class<?> clazz)
          Processor が生成したソースを文字列と比較・検証します.
protected  void assertEqualsGeneratedSource(CharSequence expected, String className)
          Processor が生成したソースを文字列と比較・検証します.
protected  void assertEqualsGeneratedSourceWithFile(File expectedSourceFile, Class<?> clazz)
          Processor が生成したソースをファイルと比較・検証します.
protected  void assertEqualsGeneratedSourceWithFile(File expectedSourceFile, String className)
          Processor が生成したソースをファイルと比較・検証します.
protected  void assertEqualsGeneratedSourceWithFile(String expectedSourceFilePath, Class<?> clazz)
          Processor が生成したソースをファイルと比較・検証します.
protected  void assertEqualsGeneratedSourceWithFile(String expectedSourceFilePath, String className)
          Processor が生成したソースをファイルと比較・検証します.
protected  void assertEqualsGeneratedSourceWithResource(String expectedResource, Class<?> clazz)
          Processor が生成したソースをクラスパス上のリソースと比較・検証します.
protected  void assertEqualsGeneratedSourceWithResource(String expectedResource, String className)
          Processor が生成したソースをクラスパス上のリソースと比較・検証します.
protected  void assertEqualsGeneratedSourceWithResource(URL expectedResourceUrl, Class<?> clazz)
          Processor が生成したソースをクラスパス上のリソースと比較・検証します.
protected  void assertEqualsGeneratedSourceWithResource(URL expectedResourceUrl, String className)
          Processor が生成したソースをクラスパス上のリソースと比較・検証します.
protected  void compile()
          コンパイルを実行します.
protected  Charset getCharset()
          文字セットを返します.
protected  Boolean getCompiledResult()
          コンパイラの実行結果を返します.
protected  ExecutableElement getConstructorElement(TypeElement typeElement)
          型エレメントに定義されたデフォルトコンストラクタの実行可能エレメントを返します.
protected  ExecutableElement getConstructorElement(TypeElement typeElement, Class<?>... parameterTypes)
          型エレメントに定義されたコンストラクタの実行可能エレメントを返します.
protected  ExecutableElement getConstructorElement(TypeElement typeElement, String... parameterTypeNames)
          型エレメントに定義されたコンストラクタの実行可能エレメントを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics()
          コンパイル中に作成された Diagnostic のリストを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Class<?> clazz)
          指定されたクラスに対する Diagnostic のリストを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Class<?> clazz, Diagnostic.Kind kind)
          指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Diagnostic.Kind kind)
          指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics(String className)
          指定されたクラスに対する Diagnostic のリストを返します.
protected  List<Diagnostic<? extends JavaFileObject>> getDiagnostics(String className, Diagnostic.Kind kind)
          指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.
protected  Elements getElementUtils()
          Elements を返します.
protected  VariableElement getFieldElement(TypeElement typeElement, Field field)
          型エレメントに定義されたフィールドの変数エレメントを返します.
protected  VariableElement getFieldElement(TypeElement typeElement, String fieldName)
          型エレメントに定義されたフィールドの変数エレメントを返します.
protected  String getGeneratedSource(Class<?> clazz)
          Processor が生成したソースを返します.
protected  String getGeneratedSource(String className)
          Processor が生成したソースを返します.
protected  Locale getLocale()
          ロケールを返します.
protected  ExecutableElement getMethodElement(TypeElement typeElement, String methodName)
          型エレメントに定義されたメソッドの実行可能エレメントを返します.
protected  ExecutableElement getMethodElement(TypeElement typeElement, String methodName, Class<?>... parameterTypes)
          型エレメントに定義されたメソッドの実行可能エレメントを返します.
protected  ExecutableElement getMethodElement(TypeElement typeElement, String methodName, String... parameterTypeNames)
          型エレメントに定義されたメソッドの実行可能エレメントを返します.
protected  ProcessingEnvironment getProcessingEnvironment()
          ProcessingEnvironment を返します.
protected  TypeElement getTypeElement(Class<?> clazz)
          クラスに対応する TypeElement を返します.
protected  TypeElement getTypeElement(String className)
          クラスに対応する TypeElement を返します.
protected  TypeMirror getTypeMirror(Class<?> clazz)
          クラスに対応する TypeMirror を返します.
protected  TypeMirror getTypeMirror(String className)
          クラスに対応する TypeMirror を返します.
protected  Types getTypeUtils()
          Types を返します.
protected  void reset()
          設定をリセットし,初期状態に戻します.
protected  void setCharset(Charset charset)
          文字セットを設定します.
protected  void setCharset(String charset)
          文字セットを設定します.
protected  void setLocale(Locale locale)
          ロケールを設定します.
protected  void setLocale(String locale)
          ロケールを設定します.
protected  void setOut(Writer out)
          コンパイラがメッセージを出力するWriterを設定します.
protected  void tearDown()
           
 
クラス junit.framework.TestCase から継承されたメソッド
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, toString
 
クラス junit.framework.Assert から継承されたメソッド
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

AptinaTestCase

protected AptinaTestCase()
インスタンスを構築します.


AptinaTestCase

protected AptinaTestCase(String name)
インスタンスを構築します.

パラメータ:
name - 名前
メソッドの詳細

tearDown

protected void tearDown()
                 throws Exception
オーバーライド:
クラス TestCase 内の tearDown
例外:
Exception

getLocale

protected Locale getLocale()
ロケールを返します.

戻り値:
ロケールまたは null

setLocale

protected void setLocale(Locale locale)
ロケールを設定します.

設定されなかった場合はプラットフォームデフォルトのロケールが使われます.

パラメータ:
locale - ロケール
関連項目:
Locale.getDefault()

setLocale

protected void setLocale(String locale)
ロケールを設定します.

設定されなかった場合はプラットフォームデフォルトのロケールが使われます.

パラメータ:
locale - ロケール
関連項目:
Locale.getDefault()

getCharset

protected Charset getCharset()
文字セットを返します.

戻り値:
文字セットまたは null

setCharset

protected void setCharset(Charset charset)
文字セットを設定します.

設定されなかった場合はプラットフォームデフォルトの文字セットが使われます.

パラメータ:
charset - 文字セット
関連項目:
Charset.defaultCharset()

setCharset

protected void setCharset(String charset)
文字セットを設定します.

設定されなかった場合はプラットフォームデフォルトの文字セットが使われます.

パラメータ:
charset - 文字セット
関連項目:
Charset.defaultCharset()

setOut

protected void setOut(Writer out)
コンパイラがメッセージを出力するWriterを設定します.

設定されなかった場合は標準エラーが使われます.

パラメータ:
out - コンパイラがメッセージを出力するWriter

addSourcePath

protected void addSourcePath(File... sourcePaths)
コンパイル時に参照するソースパスを追加します.

パラメータ:
sourcePaths - コンパイル時に参照するソースパスの並び

addSourcePath

protected void addSourcePath(String... sourcePaths)
コンパイル時に参照するソースパスを追加します.

パラメータ:
sourcePaths - コンパイル時に参照するソースパスの並び

addOption

protected void addOption(String... options)
コンパイラオプションを追加します.

パラメータ:
options - 形式のコンパイラオプションの並び

addProcessor

protected void addProcessor(Processor... processors)
注釈を処理するProcessorを追加します.

パラメータ:
processors - 注釈を処理するProcessorの並び

addCompilationUnit

protected void addCompilationUnit(Class<?> clazz)
コンパイル対象のクラスを追加します.

指定されたクラスのソースはソースパス上に存在していなければなりません.

パラメータ:
clazz - コンパイル対象クラス

addCompilationUnit

protected void addCompilationUnit(String className)
コンパイル対象のクラスを追加します.

指定されたクラスのソースはソースパス上に存在していなければなりません.

パラメータ:
className - コンパイル対象クラスの完全限定名

addCompilationUnit

protected void addCompilationUnit(Class<?> clazz,
                                  CharSequence source)
コンパイル対象のクラスをソースとともに追加します.

パラメータ:
clazz - コンパイル対象クラス
source - ソース

addCompilationUnit

protected void addCompilationUnit(String className,
                                  CharSequence source)
コンパイル対象のクラスをソースとともに追加します.

パラメータ:
className - コンパイル対象クラスの完全限定名
source - ソース

compile

protected void compile()
                throws IOException
コンパイルを実行します.

例外:
IOException - 入出力例外が発生した場合

getCompiledResult

protected Boolean getCompiledResult()
                             throws IllegalStateException
コンパイラの実行結果を返します.

戻り値:
コンパイラの実行結果
例外:
IllegalStateException - compile() が呼び出されていない場合
関連項目:
JavaCompiler.CompilationTask.call()

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics()
                                                             throws IllegalStateException
コンパイル中に作成された Diagnostic のリストを返します.

戻り値:
コンパイル中に作成された Diagnostic のリスト
例外:
IllegalStateException - compile() が呼び出されていない場合

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Class<?> clazz)
指定されたクラスに対する Diagnostic のリストを返します.

パラメータ:
clazz - 取得するクラス
戻り値:
指定されたクラスに対する Diagnostic のリスト

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics(String className)
指定されたクラスに対する Diagnostic のリストを返します.

パラメータ:
className - 取得するクラス名
戻り値:
指定されたクラスに対する Diagnostic のリスト

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Diagnostic.Kind kind)
指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.

パラメータ:
kind - 取得する Diagnostic.Kind
戻り値:
指定されたDiagnostic.Kind を持つ Diagnostic のリスト

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics(Class<?> clazz,
                                                                    Diagnostic.Kind kind)
指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.

パラメータ:
clazz - 取得するクラス
kind - 取得する Diagnostic.Kind
戻り値:
指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリスト

getDiagnostics

protected List<Diagnostic<? extends JavaFileObject>> getDiagnostics(String className,
                                                                    Diagnostic.Kind kind)
指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリストを返します.

パラメータ:
className - 取得するクラス名
kind - 取得する Diagnostic.Kind
戻り値:
指定されたクラスに対する指定された Diagnostic.Kind を持つ Diagnostic のリスト

getProcessingEnvironment

protected ProcessingEnvironment getProcessingEnvironment()
                                                  throws IllegalStateException
ProcessingEnvironment を返します.

戻り値:
ProcessingEnvironment
例外:
IllegalStateException - compile() が呼び出されていない場合

getElementUtils

protected Elements getElementUtils()
                            throws IllegalStateException
Elements を返します.

戻り値:
Elements
例外:
IllegalStateException - compile() が呼び出されていない場合
関連項目:
ProcessingEnvironment.getElementUtils()

getTypeUtils

protected Types getTypeUtils()
                      throws IllegalStateException
Types を返します.

戻り値:
Types
例外:
IllegalStateException - compile() が呼び出されていない場合
関連項目:
ProcessingEnvironment.getTypeUtils()

getTypeElement

protected TypeElement getTypeElement(Class<?> clazz)
                              throws IllegalStateException
クラスに対応する TypeElement を返します.

このメソッドが返す TypeElement およびその Element.getEnclosedElements() が返す Element から, Elements.getDocComment(Element) を使って Javadoc コメントを取得することはできません.

パラメータ:
clazz - クラス
戻り値:
クラスに対応するTypeElement, 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getTypeElement

protected TypeElement getTypeElement(String className)
                              throws IllegalStateException
クラスに対応する TypeElement を返します.

このメソッドが返す TypeElement およびその Element.getEnclosedElements() が返す Element から, Elements.getDocComment(Element) を使って Javadoc コメントを取得することはできません.

パラメータ:
className - クラスの完全限定名
戻り値:
クラスに対応するTypeElement, 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getFieldElement

protected VariableElement getFieldElement(TypeElement typeElement,
                                          Field field)
                                   throws IllegalStateException
型エレメントに定義されたフィールドの変数エレメントを返します.

パラメータ:
typeElement - 型エレメント
field - フィールド
戻り値:
型エレメントに定義されたフィールドの変数エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getFieldElement

protected VariableElement getFieldElement(TypeElement typeElement,
                                          String fieldName)
                                   throws IllegalStateException
型エレメントに定義されたフィールドの変数エレメントを返します.

パラメータ:
typeElement - 型エレメント
fieldName - フィールド名
戻り値:
型エレメントに定義されたフィールドの変数エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getConstructorElement

protected ExecutableElement getConstructorElement(TypeElement typeElement)
                                           throws IllegalStateException
型エレメントに定義されたデフォルトコンストラクタの実行可能エレメントを返します.

パラメータ:
typeElement - 型エレメント
戻り値:
型エレメントに定義されたデフォルトコンストラクタの実行可能エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getConstructorElement

protected ExecutableElement getConstructorElement(TypeElement typeElement,
                                                  Class<?>... parameterTypes)
                                           throws IllegalStateException
型エレメントに定義されたコンストラクタの実行可能エレメントを返します.

引数型が型引数を持つ場合は getConstructorElement(TypeElement, String...) を使用してください.

パラメータ:
typeElement - 型エレメント
parameterTypes - 引数型の並び
戻り値:
型エレメントに定義されたコンストラクタの実行可能エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getConstructorElement

protected ExecutableElement getConstructorElement(TypeElement typeElement,
                                                  String... parameterTypeNames)
                                           throws IllegalStateException
型エレメントに定義されたコンストラクタの実行可能エレメントを返します.

引数がの型が配列の場合は, 要素型の名前の後に [] を連ねる形式と, [[LString; のような形式のどちらでも指定することができます.

引数型が型引数を持つ場合は "java.util.List&lt;T&gt;" のようにそのまま指定します.

パラメータ:
typeElement - 型エレメント
parameterTypeNames - 引数の型名の並び
戻り値:
型エレメントに定義されたコンストラクタの実行可能エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getMethodElement

protected ExecutableElement getMethodElement(TypeElement typeElement,
                                             String methodName)
                                      throws IllegalStateException
型エレメントに定義されたメソッドの実行可能エレメントを返します.

パラメータ:
typeElement - 型エレメント
methodName - メソッド名
戻り値:
型エレメントに定義されたメソッドの実行可能エレメント.存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getMethodElement

protected ExecutableElement getMethodElement(TypeElement typeElement,
                                             String methodName,
                                             Class<?>... parameterTypes)
                                      throws IllegalStateException
型エレメントに定義されたメソッドの実行可能エレメントを返します.

引数型が型引数を持つ場合は getMethodElement(TypeElement, String, String...) を使用してください.

パラメータ:
typeElement - 型エレメント
methodName - メソッド名
parameterTypes - 引数型の並び
戻り値:
型エレメントに定義されたメソッドの実行可能エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getMethodElement

protected ExecutableElement getMethodElement(TypeElement typeElement,
                                             String methodName,
                                             String... parameterTypeNames)
                                      throws IllegalStateException
型エレメントに定義されたメソッドの実行可能エレメントを返します.

引数がの型が配列の場合は, 要素型の名前の後に [] を連ねる形式と, [[LString; のような形式のどちらでも指定することができます.

引数型が型引数を持つ場合は "java.util.List&lt;T&gt;" のようにそのまま指定します.

パラメータ:
typeElement - 型エレメント
methodName - メソッド名
parameterTypeNames - 引数の型名の並び
戻り値:
型エレメントに定義されたメソッドの実行可能エレメント. 存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getTypeMirror

protected TypeMirror getTypeMirror(Class<?> clazz)
                            throws IllegalStateException
クラスに対応する TypeMirror を返します.

パラメータ:
clazz - クラス
戻り値:
クラスに対応するTypeMirror, クラスが存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getTypeMirror

protected TypeMirror getTypeMirror(String className)
                            throws IllegalStateException
クラスに対応する TypeMirror を返します.

配列の場合は要素型の名前の後に [] を連ねる形式と, [[LString; のような 形式のどちらでも指定することができます.

パラメータ:
className - クラスの完全限定名
戻り値:
クラスに対応するTypeMirror, クラスが存在しない場合は null
例外:
IllegalStateException - compile() が呼び出されていない場合

getGeneratedSource

protected String getGeneratedSource(Class<?> clazz)
                             throws IllegalStateException,
                                    IOException,
                                    SourceNotGeneratedException
Processor が生成したソースを返します.

パラメータ:
clazz - 生成されたクラス
戻り値:
生成されたソースの内容
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合

getGeneratedSource

protected String getGeneratedSource(String className)
                             throws IllegalStateException,
                                    IOException,
                                    SourceNotGeneratedException
Processor が生成したソースを返します.

パラメータ:
className - 生成されたクラスの完全限定名
戻り値:
生成されたソースの内容
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合

assertEqualsByLine

protected void assertEqualsByLine(String expected,
                                  String actual)
文字列を行単位で比較します.

パラメータ:
expected - 期待される文字列
actual - 実際の文字列

assertEqualsByLine

protected void assertEqualsByLine(BufferedReader expectedReader,
                                  BufferedReader actualReader)
                           throws IOException
文字列を行単位で比較します.

パラメータ:
expectedReader - 期待される文字列の入力ストリーム
actualReader - 実際の文字列の入力ストリーム
例外:
IOException - 入出力例外が発生した場合

assertEqualsGeneratedSource

protected void assertEqualsGeneratedSource(CharSequence expected,
                                           Class<?> clazz)
                                    throws IllegalStateException,
                                           IOException,
                                           SourceNotGeneratedException,
                                           ComparisonFailure
Processor が生成したソースを文字列と比較・検証します.

パラメータ:
expected - 生成されたソースに期待される内容の文字列
clazz - 生成されたクラス
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSource

protected void assertEqualsGeneratedSource(CharSequence expected,
                                           String className)
                                    throws IllegalStateException,
                                           IOException,
                                           SourceNotGeneratedException,
                                           ComparisonFailure
Processor が生成したソースを文字列と比較・検証します.

パラメータ:
expected - 生成されたソースに期待される内容の文字列
className - 生成されたクラスの完全限定名
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithFile

protected void assertEqualsGeneratedSourceWithFile(File expectedSourceFile,
                                                   Class<?> clazz)
                                            throws IllegalStateException,
                                                   IOException,
                                                   SourceNotGeneratedException,
                                                   ComparisonFailure
Processor が生成したソースをファイルと比較・検証します.

パラメータ:
expectedSourceFile - 生成されたソースに期待される内容を持つファイル
clazz - 生成されたクラス
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithFile

protected void assertEqualsGeneratedSourceWithFile(File expectedSourceFile,
                                                   String className)
                                            throws IllegalStateException,
                                                   IOException,
                                                   SourceNotGeneratedException,
                                                   ComparisonFailure
Processor が生成したソースをファイルと比較・検証します.

パラメータ:
expectedSourceFile - 生成されたソースに期待される内容を持つファイル
className - クラスの完全限定名
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithFile

protected void assertEqualsGeneratedSourceWithFile(String expectedSourceFilePath,
                                                   Class<?> clazz)
                                            throws IllegalStateException,
                                                   IOException,
                                                   SourceNotGeneratedException,
                                                   ComparisonFailure
Processor が生成したソースをファイルと比較・検証します.

パラメータ:
expectedSourceFilePath - 生成されたソースに期待される内容を持つファイルのパス
clazz - 生成されたクラス
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithFile

protected void assertEqualsGeneratedSourceWithFile(String expectedSourceFilePath,
                                                   String className)
                                            throws IllegalStateException,
                                                   IOException,
                                                   SourceNotGeneratedException,
                                                   ComparisonFailure
Processor が生成したソースをファイルと比較・検証します.

パラメータ:
expectedSourceFilePath - 生成されたソースに期待される内容を持つファイルのパス
className - 生成されたクラスの完全限定名
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithResource

protected void assertEqualsGeneratedSourceWithResource(URL expectedResourceUrl,
                                                       Class<?> clazz)
                                                throws IllegalStateException,
                                                       IOException,
                                                       SourceNotGeneratedException,
                                                       ComparisonFailure
Processor が生成したソースをクラスパス上のリソースと比較・検証します.

パラメータ:
expectedResourceUrl - 生成されたソースに期待される内容を持つリソースのURL
clazz - 生成されたクラス
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithResource

protected void assertEqualsGeneratedSourceWithResource(URL expectedResourceUrl,
                                                       String className)
                                                throws IllegalStateException,
                                                       IOException,
                                                       SourceNotGeneratedException,
                                                       ComparisonFailure
Processor が生成したソースをクラスパス上のリソースと比較・検証します.

パラメータ:
expectedResourceUrl - 生成されたソースに期待される内容を持つリソースのURL
className - 生成されたクラスの完全限定名
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithResource

protected void assertEqualsGeneratedSourceWithResource(String expectedResource,
                                                       Class<?> clazz)
                                                throws IllegalStateException,
                                                       IOException,
                                                       SourceNotGeneratedException,
                                                       ComparisonFailure
Processor が生成したソースをクラスパス上のリソースと比較・検証します.

パラメータ:
expectedResource - 生成されたソースに期待される内容を持つリソースのパス
clazz - 生成されたクラス
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

assertEqualsGeneratedSourceWithResource

protected void assertEqualsGeneratedSourceWithResource(String expectedResource,
                                                       String className)
                                                throws IllegalStateException,
                                                       IOException,
                                                       SourceNotGeneratedException,
                                                       ComparisonFailure
Processor が生成したソースをクラスパス上のリソースと比較・検証します.

パラメータ:
expectedResource - 生成されたソースに期待される内容を持つリソースのパス
className - 生成されたクラスの完全限定名
例外:
IllegalStateException - compile() が呼び出されていない場合
IOException - 入出力例外が発生した場合
SourceNotGeneratedException - ソースが生成されなかった場合
ComparisonFailure - 生成されたソースが期待される内容と一致しなかった場合

reset

protected void reset()
設定をリセットし,初期状態に戻します.

compile() 呼び出し前に設定した内容も, compile() によって得られた状態も全てリセットされます.



Copyright © 2009-2010 The Seasar Foundation. All Rights Reserved.