Spock Web Console

subscribe to the feed Subscribe
hashmap-test (via #spockwebconsole)
tweet this script Tweet


Published 2 years ago by ss with tags demo
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
import spock.lang.*

// Hit 'Run Script' below
class MyFirstSpec extends Specification {
def "HashMap accepts null key"() {
      given: "a hashmap"
        def map = [:]

      when: "item is inserted with null as key"
        map.put(null, "elem")

      then: "NullPointerException isn't thrown"
        notThrown NullPointerException
        map[null] == "elem"