Java Doc for BookstoreTest.java in  » Testing » mockrunner-0.4 » com » mockrunner » example » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » mockrunner 0.4 » com.mockrunner.example.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.mockrunner.jdbc.BasicJDBCTestCaseAdapter
   com.mockrunner.example.jdbc.BookstoreTest

BookstoreTest
public class BookstoreTest extends BasicJDBCTestCaseAdapter (Code)
Example test for Bookstore . Demonstrates the usage of com.mockrunner.jdbc.JDBCTestModule and com.mockrunner.jdbc.BasicJDBCTestCaseAdapter . This is an example for the handling of com.mockrunner.mock.jdbc.MockResultSet . The data that the JDBC code should receive when executing the select statement is specified in the file bookstore.txt. Please note that we do not pass a filled List to the order method in the succesful order test, because the choice if a table row should be in the result is done by SQL. The framework does not execute any SQL. In the second test, we check the correct SQL string. In the third test, we specify that the statement should raise an SQL exception (to simulate a database error) and verify, that the transaction is rolled back. This example uses regular expressions. Per default, regular expressions are disabled, i.e. the preparation of result sets and verification of executed SQL statements is based on simple string comparison. With

setUseRegularExpressions(true);

and

getStatementResultSetHandler().setUseRegularExpressions(true);
you enable regular expressions for the preparation of result sets and verification of executed SQL statements (note that for prepared and callable statements you would have to enable it seperately). E.g. prepareResultSet("select.*isbn,.*quantity.*", result) means that only the words select, isbn,, and quantity must appear in the specified order, all other characters are irrelevant. Besides that simple example, you can use any Perl5 compatible expression.




Method Summary
protected  voidsetUp()
    
public  voidtestCorrectSQL()
    
public  voidtestException()
    
public  voidtestSuccessfulOrder()
    



Method Detail
setUp
protected void setUp() throws Exception(Code)



testCorrectSQL
public void testCorrectSQL() throws Exception(Code)



testException
public void testException() throws Exception(Code)



testSuccessfulOrder
public void testSuccessfulOrder() throws Exception(Code)



Methods inherited from com.mockrunner.jdbc.BasicJDBCTestCaseAdapter
protected JDBCMockObjectFactory createJDBCMockObjectFactory()(Code)(Java Doc)
protected JDBCTestModule createJDBCTestModule()(Code)(Java Doc)
protected JDBCTestModule createJDBCTestModule(JDBCMockObjectFactory mockFactory)(Code)(Java Doc)
protected MockCallableStatement getCallableStatement(String sql)(Code)(Java Doc)
protected MockCallableStatement getCallableStatement(int index)(Code)(Java Doc)
protected Object getCallableStatementParameter(String sql, String nameOfParameter)(Code)(Java Doc)
protected Object getCallableStatementParameter(int indexOfStatement, String nameOfParameter)(Code)(Java Doc)
protected Object getCallableStatementParameter(CallableStatement statement, String nameOfParameter)(Code)(Java Doc)
protected Object getCallableStatementParameter(String sql, int indexOfParameter)(Code)(Java Doc)
protected Object getCallableStatementParameter(CallableStatement statement, int indexOfParameter)(Code)(Java Doc)
protected Object getCallableStatementParameter(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected CallableStatementResultSetHandler getCallableStatementResultSetHandler()(Code)(Java Doc)
protected List getCallableStatements(String sql)(Code)(Java Doc)
protected List getCallableStatements()(Code)(Java Doc)
protected Map getExecutedSQLStatementParameter()(Code)(Java Doc)
protected Map getExecutedSQLStatementParameterMap()(Code)(Java Doc)
protected ParameterSets getExecutedSQLStatementParameterSets(String sql)(Code)(Java Doc)
protected List getExecutedSQLStatements()(Code)(Java Doc)
protected JDBCMockObjectFactory getJDBCMockObjectFactory()(Code)(Java Doc)
protected JDBCTestModule getJDBCTestModule()(Code)(Java Doc)
protected MockPreparedStatement getPreparedStatement(String sql)(Code)(Java Doc)
protected MockPreparedStatement getPreparedStatement(int index)(Code)(Java Doc)
protected Object getPreparedStatementParameter(String sql, int indexOfParameter)(Code)(Java Doc)
protected Object getPreparedStatementParameter(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected Object getPreparedStatementParameter(PreparedStatement statement, int indexOfParameter)(Code)(Java Doc)
protected PreparedStatementResultSetHandler getPreparedStatementResultSetHandler()(Code)(Java Doc)
protected List getPreparedStatements(String sql)(Code)(Java Doc)
protected List getPreparedStatements()(Code)(Java Doc)
protected MockResultSet getReturnedResultSet(String id)(Code)(Java Doc)
protected List getReturnedResultSets(String id)(Code)(Java Doc)
protected List getReturnedResultSets()(Code)(Java Doc)
protected MockStatement getStatement(int index)(Code)(Java Doc)
protected StatementResultSetHandler getStatementResultSetHandler()(Code)(Java Doc)
protected List getStatements()(Code)(Java Doc)
protected void setCaseSensitive(boolean caseSensitive)(Code)(Java Doc)
protected void setExactMatch(boolean exactMatch)(Code)(Java Doc)
protected void setJDBCMockObjectFactory(JDBCMockObjectFactory jdbcMockObjectFactory)(Code)(Java Doc)
protected void setJDBCTestModule(JDBCTestModule jdbcTestModule)(Code)(Java Doc)
protected void setUp() throws Exception(Code)(Java Doc)
protected void setUseRegularExpressions(boolean useRegularExpressions)(Code)(Java Doc)
protected void tearDown() throws Exception(Code)(Java Doc)
protected void verifyAllResultSetsClosed()(Code)(Java Doc)
protected void verifyAllStatementsClosed()(Code)(Java Doc)
protected void verifyCallableStatementClosed(int index)(Code)(Java Doc)
protected void verifyCallableStatementClosed(String sql)(Code)(Java Doc)
protected void verifyCallableStatementNotPresent(String sql)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(CallableStatement statement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(String sql, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(CallableStatement statement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(String sql, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementOutParameterRegistered(int indexOfStatement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameter(int indexOfStatement, String nameOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameter(CallableStatement statement, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameter(String sql, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameter(int indexOfStatement, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameter(CallableStatement statement, String nameOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameter(String sql, String nameOfParameter, Object object)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(CallableStatement statement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(CallableStatement statement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(String sql, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(int indexOfStatement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterNotPresent(String sql, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(int indexOfStatement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(CallableStatement statement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(String sql, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(String sql, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementParameterPresent(CallableStatement statement, String nameOfParameter)(Code)(Java Doc)
protected void verifyCallableStatementPresent(String sql)(Code)(Java Doc)
protected void verifyCommitted()(Code)(Java Doc)
protected void verifyConnectionClosed()(Code)(Java Doc)
protected void verifyNotCommitted()(Code)(Java Doc)
protected void verifyNotRolledBack()(Code)(Java Doc)
protected void verifyNumberCallableStatements(int number, String sql)(Code)(Java Doc)
protected void verifyNumberCallableStatements(int number)(Code)(Java Doc)
protected void verifyNumberCommits(int number)(Code)(Java Doc)
protected void verifyNumberPreparedStatements(int number, String sql)(Code)(Java Doc)
protected void verifyNumberPreparedStatements(int number)(Code)(Java Doc)
protected void verifyNumberRollbacks(int number)(Code)(Java Doc)
protected void verifyNumberStatements(int number)(Code)(Java Doc)
protected void verifyPreparedStatementClosed(String sql)(Code)(Java Doc)
protected void verifyPreparedStatementClosed(int index)(Code)(Java Doc)
protected void verifyPreparedStatementNotPresent(String sql)(Code)(Java Doc)
protected void verifyPreparedStatementParameter(PreparedStatement statement, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyPreparedStatementParameter(String sql, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyPreparedStatementParameter(int indexOfStatement, int indexOfParameter, Object object)(Code)(Java Doc)
protected void verifyPreparedStatementParameterNotPresent(String sql, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementParameterNotPresent(PreparedStatement statement, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementParameterNotPresent(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementParameterPresent(PreparedStatement statement, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementParameterPresent(String sql, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementParameterPresent(int indexOfStatement, int indexOfParameter)(Code)(Java Doc)
protected void verifyPreparedStatementPresent(String sql)(Code)(Java Doc)
protected void verifyResultSetClosed(String id)(Code)(Java Doc)
protected void verifyResultSetColumn(String id, String name, List columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(MockResultSet resultSet, int number, List columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(MockResultSet resultSet, int number, Object[] columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(String id, int number, List columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(String id, int number, Object[] columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(MockResultSet resultSet, String name, List columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(MockResultSet resultSet, String name, Object[] columnData)(Code)(Java Doc)
protected void verifyResultSetColumn(String id, String name, Object[] columnData)(Code)(Java Doc)
protected void verifyResultSetEquals(String id, MockResultSet target)(Code)(Java Doc)
protected void verifyResultSetEquals(MockResultSet source, MockResultSet target)(Code)(Java Doc)
protected void verifyResultSetRow(MockResultSet resultSet, int number, List rowData)(Code)(Java Doc)
protected void verifyResultSetRow(MockResultSet resultSet, int number, Object[] rowData)(Code)(Java Doc)
protected void verifyResultSetRow(String id, int number, List rowData)(Code)(Java Doc)
protected void verifyResultSetRow(String id, int number, Object[] rowData)(Code)(Java Doc)
protected void verifyResultSetRowDeleted(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowDeleted(String id, int number)(Code)(Java Doc)
protected void verifyResultSetRowInserted(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowInserted(String id, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotDeleted(String id, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotDeleted(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotInserted(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotInserted(String id, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotUpdated(String id, int number)(Code)(Java Doc)
protected void verifyResultSetRowNotUpdated(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowUpdated(MockResultSet resultSet, int number)(Code)(Java Doc)
protected void verifyResultSetRowUpdated(String id, int number)(Code)(Java Doc)
protected void verifyRolledBack()(Code)(Java Doc)
protected void verifySQLStatementExecuted(String sql)(Code)(Java Doc)
protected void verifySQLStatementNotExecuted(String sql)(Code)(Java Doc)
protected void verifySQLStatementParameter(String sql, int indexOfParameterSet, String nameOfParameter, Object expectedParameter)(Code)(Java Doc)
protected void verifySQLStatementParameter(String sql, int indexOfParameterSet, int indexOfParameter, Object expectedParameter)(Code)(Java Doc)
protected void verifySQLStatementParameter(String sql, int indexOfParameterSet, Map parameterMap)(Code)(Java Doc)
protected void verifySQLStatementParameterNumber(String sql, int indexOfParameterSet, int number)(Code)(Java Doc)
protected void verifyStatementClosed(int index)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.