-
Mar 7th, 2013, 02:17 PM
#1
Mocking the Sql object
I need to mock the results of a Sql query. This is the code being tested.
def query = "select field1, field2 from table1"
def sql = new Sql(dataSource)
def results = []
sql.eachRow(query) {
results << [ someKey:field1, someValue:field2 ]
}
I'm trying to use mockFor(Sql) and override the sql.eachRow method without much luck. Any ideas?
Steve
-
Mar 7th, 2013, 05:18 PM
#2
Just this alone causes the test to fail...
def mockSql = MockFor(Sql)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules