jp.sf.amateras.mirage.test
Class MirageTestContext

java.lang.Object
  extended by jp.sf.amateras.mirage.test.MirageTestContext

public class MirageTestContext
extends Object

Author:
Naoki Takezoe
See Also:
MockSqlManager

Constructor Summary
MirageTestContext()
           
 
Method Summary
static void addResult(Object result)
           
static ExecutedSQLInfo getExecutedSQLInfo(int index)
           
static void initMirageTestContext()
          Initializes the MirageTestContext.
static void setNameConverter(NameConverter nameConverter)
           
static void verifyDeleteSql(int indexOfSql, Object entity)
          Verifies the SQL and parameters which is executed by SqlManager.deleteEntity(Object).
static void verifyFindSql(int indexOfSql, Class<?> entityClass, Object... id)
          Verifies the SQL and parameters which is executed by SqlManager.findEntity(Class, Object...).
static void verifyInsertSql(int indexOfSql, Object entity)
          Verifies the SQL and parameters which is executed by SqlManager.insertEntity(Object).
static void verifySql(int indexOfSql, String sql)
          Verifies the executed SQL.
static void verifySql(int indexOfSql, String sql, Object... values)
          Verifies the executed SQL and parameters.
static void verifySqlByRegExp(int indexOfSql, String regexp)
          Verifies the executed SQL using the regular expression.
static void verifySqlByRegExp(int indexOfSql, String regexp, Object... values)
          Verifies the executed SQL and parameters using the regular expression.
static void verifySqlNumber(int expected)
          Verifies the number of executed SQLs.
static void verifyUpdatetSql(int indexOfSql, Object entity)
          Verifies the SQL and parameters which is executed by SqlManager.updateEntity(Object).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MirageTestContext

public MirageTestContext()
Method Detail

initMirageTestContext

public static void initMirageTestContext()
Initializes the MirageTestContext.

This method clears the result list and the executed sql list. You have to invoke this method at setUp() of your test case.


setNameConverter

public static void setNameConverter(NameConverter nameConverter)

addResult

public static void addResult(Object result)

getExecutedSQLInfo

public static ExecutedSQLInfo getExecutedSQLInfo(int index)

verifySqlNumber

public static void verifySqlNumber(int expected)
Verifies the number of executed SQLs.

Parameters:
expected - the expected number of executed SQLs

verifySql

public static void verifySql(int indexOfSql,
                             String sql)
Verifies the executed SQL.

Parameters:
indexOfSql - the index of executed SQL
sql - the expected SQL

verifySql

public static void verifySql(int indexOfSql,
                             String sql,
                             Object... values)
Verifies the executed SQL and parameters.

Parameters:
indexOfSql - the index of executed SQL
sql - the expected SQL
values - PreparedStatement parameters

verifySqlByRegExp

public static void verifySqlByRegExp(int indexOfSql,
                                     String regexp)
Verifies the executed SQL using the regular expression.

Parameters:
indexOfSql - the index of executed SQL
regexp - the pattern of expected SQL

verifySqlByRegExp

public static void verifySqlByRegExp(int indexOfSql,
                                     String regexp,
                                     Object... values)
Verifies the executed SQL and parameters using the regular expression.

Parameters:
indexOfSql - the index of executed SQL
regexp - the pattern of expected SQL
values - PreparedStatement parameters

verifyFindSql

public static void verifyFindSql(int indexOfSql,
                                 Class<?> entityClass,
                                 Object... id)
Verifies the SQL and parameters which is executed by SqlManager.findEntity(Class, Object...).

Parameters:
indexOfSql - the index of executed SQL
id - the values of primary key

verifyInsertSql

public static void verifyInsertSql(int indexOfSql,
                                   Object entity)
Verifies the SQL and parameters which is executed by SqlManager.insertEntity(Object).

Parameters:
indexOfSql - the index of executed SQL
entity - the entity which should be inserted

verifyUpdatetSql

public static void verifyUpdatetSql(int indexOfSql,
                                    Object entity)
Verifies the SQL and parameters which is executed by SqlManager.updateEntity(Object).

Parameters:
indexOfSql - the index of executed SQL
entity - the entity which should be updated

verifyDeleteSql

public static void verifyDeleteSql(int indexOfSql,
                                   Object entity)
Verifies the SQL and parameters which is executed by SqlManager.deleteEntity(Object).

Parameters:
indexOfSql - the index of executed SQL
entity - the entity which should be deleted


Copyright © 2010-2012 Project Amateras. All Rights Reserved.