This file contains hidden or 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
| given: 'open a database connection' | |
| // code goes here | |
| and: 'seed the customer table' | |
| // code goes here | |
| and: 'seed the product table' | |
| // code goes here |
This file contains hidden or 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
| def 'Allow user access only for 18 over'(name, age, expected) { | |
| given: 'user entity' | |
| def user = new User(name, age) | |
| when: 'validate user access' | |
| def userCanAccess = AccessService().grantUser(user) | |
| then: | |
| userCanAccess == expected |
This file contains hidden or 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
| def 'Maximum of two numbers'() { | |
| expect: | |
| Math.max(a, b) == c | |
| where: | |
| a | b | c | |
| 1 | 3 | 3 | |
| 7 | 4 | 4 | |
| 0 | 0 | 0 |
This file contains hidden or 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
| Condition not satisfied: | |
| Math.max(a, b) == c | |
| | | | | | | | |
| | 7 7 4 | 4 | |
| | false | |
| class java.lang.Math |
This file contains hidden or 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
| @Unroll | |
| def 'Maximum of #a and #b is #c'() { | |
| expect: | |
| Math.max(a, b) == c | |
| where: | |
| a | b | c | |
| 1 | 3 | 3 | |
| 7 | 4 | 4 |
This file contains hidden or 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
| maximum of 1 and 3 is 3 PASSED | |
| maximum of 7 and 4 is 4 FAILED | |
| Math.max(a, b) == c | |
| | | | | | | | |
| | 7 7 4 | 4 | |
| | false | |
| class java.lang.Math | |
| maximum of 0 and 0 is 0 PASSED |
This file contains hidden or 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
| def subscriber1 = Mock(Subscriber) | |
| def subscriber2 = Mock(Subscriber) |
This file contains hidden or 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
| Subscriber subscriber1 = Mock() | |
| Subscriber subscriber2 = Mock() |
This file contains hidden or 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
| class Publisher { | |
| List<Subscriber> subscribers = [] | |
| void send(String message){ | |
| subscribers*.receive(message) | |
| } | |
| } | |
| interface Subscriber { | |
| void receive(String message) | |
| } |
This file contains hidden or 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
| 1 * subscriber1.receive("hello") | |
| | | | | | |
| | | | restrição de argumento | |
| | | restrição de método | |
| | restrição de alvo | |
| restrição por cardinalidade |