Spock Web Console

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

hash test

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

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"
    }
}