I am developing using IntelliJ IDEA, so I describe how to configure live template using this IDE. Select File->Settings...->Live Templates. Now add new template group and add new template inside this. Abbreviation set to something meaningful and short, for example spock. As template text use code below:
@spock.lang.Unroll def "should $END$"(){ given: when: then: where: }Set also option "Reformat according to style", apllicable set to groovy and choose expand key.
Now, when you type spock and click expand key (in my case it is Tab) in editor, then spock will be replaced with template and coursor will be set after space in test method name.
Thanks for sharing. It's exactly what I am looking for.
ReplyDelete