Spock Web Console

subscribe to the feed Subscribe
sisg - 03 Spock Basics: The "old" Method (via #spockwebconsole)
tweet this script Tweet

sisg - 03 Spock Basics: The "old" Method

Published 3 months ago by Matthias Schulz with tags sisg Spock Basics old
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
package basics

import spock.lang.Specification

class TheOldMethodSpec extends Specification{


    def "Test 1: Compare old and new values"() {
        given:
        int i = 0

        when:
        i++

        then:
        i > old(i)
        i == old(i) + 1
        println("i = $i; old(i) = ${old(i)}")

        when:
        i++

        then:
        println("i = $i; old(i) = ${old(i)}")
    }


}