Search Results

Search found 1 results on 1 pages for 'dipess'.

Page 1/1 | 1 

  • Unit testing a Grails custom taglib based on built-in Grails taglib

    - by dipess
    I've an app based on Grails 1.3.7. And I need to write a unit test for a custom taglib that is based on the built-in taglib, <g:select /> to be specific. I checked out the solution on this previous SO post but the solution stated is not working in my case (some properties are not being prooperly mocked up). The other solution that I found was this. Using this approach, I get most of the properties of FormTagLib mocked up except for the grailsApplication property that select requires. The actual error that I get is Cannot invoke method getArtefact() on null object. How can I properly write the unit test in such a case? Edit Here are my test class and the full stacktrace. Line #45 on the stacktrace is the call to the g.select from my custom taglib. My custom taglib is something like def clientSpecificQueues = {attrs-> def queueList = taskService.getClientSpecificQueues(session.clientName) def queueLabel = "Some String" if (queueList.size() > 0){ out << queueLabel else out << g.select(name:'queueId', from: queueList, optionKey: 'id', optionValue: 'name') }

    Read the article

1