Spock Web Console

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

Testing Privates

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

class PrivateTest {
    private String getStatus() {
        return "I'm private"
    }
}

// Hit 'Run Script' below
class PrivateTestSpec extends Specification {
  def "test private method"() {
    PrivateTest pt = new PrivateTest()

    expect:
    pt.getStatus() == "I'm private"
  }
}