Skip to content

Instantly share code, notes, and snippets.

@jjballano
Last active December 21, 2016 18:32
Show Gist options
  • Save jjballano/5fdf15fc425030d4ed19651c3e19e4af to your computer and use it in GitHub Desktop.
Save jjballano/5fdf15fc425030d4ed19651c3e19e4af to your computer and use it in GitHub Desktop.
@TestFor(MyService)
class MyServiceSpec extends Specification {
void "any test"(){
given:
anotherService.xyz() >> 7
when:
Integer value = service.anyMethod()
then:
value == 7
}
AnotherService anotherService = Mock(AnotherService)
def setup(){
service.anotherService = anotherService
}
}
class MyService {
AnotherService anotherService
Integer anyMethod(){
anotherService.xyz()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment