Groovy overloaded operator (bit shift on objects)
This example come from "Groovy Goodness Notebook".Clone repo:
git clone https://github.com/piotrpietrzak/gatchaman.gitSwitch to branch:
git checkout origin/groovy/multiple_overloaded_operator_methodsTest in spock is quite interesting:
def "should add operation for user" () { setup: Priviledge priviledge = new Priviledge() User user = new User(name: 'Test name') Operation operation = new Operation(name: 'Test operation') when: priviledge << user << operation then: priviledge.users.contains user priviledge.operations.contains operation }
No comments:
Post a Comment