Skip to content

Instantly share code, notes, and snippets.

@ColinHarrington
Forked from haydenmuhl/gist:1078293
Created July 12, 2011 16:21
Show Gist options
  • Save ColinHarrington/1078341 to your computer and use it in GitHub Desktop.
Save ColinHarrington/1078341 to your computer and use it in GitHub Desktop.
Grails testing, error when using mockFor
Code:
class RepoControllerTests extends ControllerUnitTestCase {
protected void setUp() {
super.setUp()
}
protected void tearDown() {
super.tearDown()
}
void testMock() {
def foo = mockFor(Repo)
foo.demand.static.listRepos(1..1) { -> return ["one", "two"] }
foo.use { // line 30
assertEquals(["one", "two"], Repo.listRepos())
}
}
}
Error:
Expecting at least 2 arguments, a category class and a Closure
java.lang.IllegalArgumentException: Expecting at least 2 arguments, a category class and a Closure
at giggity.RepoControllerTests.testMock(RepoControllerTests.groovy:30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment