-
-
Save ColinHarrington/1078341 to your computer and use it in GitHub Desktop.
Grails testing, error when using mockFor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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