There is a simple way to mock this:
// URLController.groovy public class SomethingToTest extends GrailsUnitTestCase{ public void test_lockMethod(){ def strictControlUser = mockFor(User); //And then simply do: strictControlUser.demand.static.lock(1..1){ Long param1 -> return User.get(param1); //In the unit test the get simply works } }
And done!
Now we are happy again
No hay comentarios:
Publicar un comentario