TestService s = new TestService(log,context,testRunner) s.xyz() class TestService{ def log def context def testRunner public TestService(log,context,testRunner){ this.log=log this.context=context this.testRunner=testRunner } public void xyz(){ log.info "hello" } }
Run result:
Tue Oct 06 20:54:29 CST 2015:INFO:hello