Package org.dbunit.database.statement
Class MockBatchStatement
java.lang.Object
org.dbunit.database.statement.MockBatchStatement
- All Implemented Interfaces:
IBatchStatement
Mock implementation of
IBatchStatement for use in unit tests.
Records all SQL strings added via addBatch(String) for later
verification, either via exact-match verify() or via
getCapturedSql() for pattern-based assertions.- Since:
- Mar 16, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddExpectedBatchStrings(String[] sql) voidvoidclose()intReturns the SQL strings that were actually passed toaddBatch(String), in the order they were added.voidsetExpectedClearBatchCalls(int callsCount) voidsetExpectedCloseCalls(int callsCount) voidsetExpectedExecuteBatchCalls(int callsCount) voidverify()
-
Constructor Details
-
MockBatchStatement
public MockBatchStatement()
-
-
Method Details
-
addExpectedBatchString
-
addExpectedBatchStrings
-
setExpectedExecuteBatchCalls
public void setExpectedExecuteBatchCalls(int callsCount) -
setExpectedClearBatchCalls
public void setExpectedClearBatchCalls(int callsCount) -
setExpectedCloseCalls
public void setExpectedCloseCalls(int callsCount) -
getCapturedSql
Returns the SQL strings that were actually passed toaddBatch(String), in the order they were added. Useful for pattern-based assertions when exact string matching viaaddExpectedBatchString(String)is too strict.- Returns:
- unmodifiable view of the captured SQL strings
-
verify
public void verify() -
addBatch
- Specified by:
addBatchin interfaceIBatchStatement- Throws:
SQLException
-
executeBatch
- Specified by:
executeBatchin interfaceIBatchStatement- Throws:
SQLException
-
clearBatch
- Specified by:
clearBatchin interfaceIBatchStatement- Throws:
SQLException
-
close
- Specified by:
closein interfaceIBatchStatement- Throws:
SQLException
-