Last active
December 21, 2016 18:32
-
-
Save jjballano/5fdf15fc425030d4ed19651c3e19e4af to your computer and use it in GitHub Desktop.
This file contains 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
@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