I need to write some unit tests for that I have to mock the Result set and Record with some dummy data. I don't know how to initialize and instantiate them. Please help
Thanks in advance.
I need to write some unit tests for that I have to mock the Result set and Record with some dummy data. I don't know how to initialize and instantiate them. Please help
Thanks in advance.
jOOQ has a few built-in mock features, see the chapter JDBC mocking for unit testing of the manual, it might be what you are looking for.
However, to simply create a jOOQ's
Result
orRecord
, you may use theDSLContext
for that:You also mention
ResultSet
, if by that you mean the JDBCResultSet
, then it might be a bit more complicated to mock that. Instead, I would suggest DbUnit, that is not a mock for JDBC classes, but you'll assist you to setup your database for tests, which might help you to get the same effects you would have by mocking JBDC classes.