Results 1 to 2 of 2

Thread: Mocking the Sql object

  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Default 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

  2. #2
    Join Date
    Mar 2013
    Posts
    2

    Default

    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
  •