Spock Web Console

subscribe to the feed Subscribe
alan (via #spockwebconsole)
tweet this script Tweet


Published 1 year ago by Anonymous
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
import spock.lang.*

class GetSpec extends Specification {
  def "Testing getter"() {
    def foo = new Foo(name: "alan")

    expect: "Getter is called"
    foo.name == "Hello alan"

    and: "Call field directly"
    foo.@name == "alan"

class Foo {
    String name
    def getName() { 
      "Hello $name"