Hi all, I am trying to write the unit test of a controller's method that uses Shiro.
I followed the instructions at: http://shiro.apache.org/testing.html I am using Spock to write my tests. Here is my setup: I have AbstractShiroTest that extends the Spock Specification class. My AccountsControllerSpec extends AbstractShiroTest. @TestFor(AccountsController) class AccountsControllerSpec extends BaseUnitSpec { def 'index'() { setup: Subject subject = mockFor(Subject) setSubject(subject) //etc ... } } I get the following error: Cannot cast object 'grails.test.GrailsMock@429a849' with class 'grails.test.GrailsMock' to class 'org.apache.shiro.subject.Subject' I want to mock the subject so I can mock methods like isPermitted or isAuthenticated. Thanks in advance!
