Spock Web Console

subscribe to the feed Subscribe
Hamcrest Matcher fails with 'where' (via #spockwebconsole)
tweet this script Tweet

Hamcrest Matcher fails with 'where'

Published 3 years ago by Stefan with tags hamcrest where
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
import spock.lang.Specification

import static spock.util.matcher.HamcrestMatchers.closeTo

class HamcrestMatchers extends Specification {
  def "comparing two decimal numbers"() {
    def dummy=expected

    expect:
    dummy closeTo(value, delta)
    expected closeTo(value, delta)

    where:
    value | expected | delta
    Math.PI | 3.14 | 0.01
  }
}