Unit testing with chain class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unit testing with chain class

yogesh
I have following chain structure in execute method of chain class
 
  chain.prefix("accounts", chain1 -> chain1
                .prefix(":account_id", chain2 -> chain2
                        .path("xyz", xyzhandler)
                        .path("pqr,pqrhandler)
                                       
To test xyzhandler, I am using GroovyRequestFixture handle method as below

                def pathBindingMap = [:]
                pathBindingMap.put("account_id", "11")
               
                when:
                def result = handle(new MainChain(xyzhandler:xyzhandler)) {
                        pathBinding pathBindingMap
                        uri  "accounts/:account_id/xyz"
                }
       
but xyzhandler is not getting called. Am I missing something or I am doing it wrong way.
Instead of Chain class if we have handler then things are working fine. But I wann do it with chain class.