Skip to main content

Spock

Basic Setup

Solution

class Adder {
  static def add(a, b) { a + b }
}
class Adder {
  static def add(a, b) { a + b }
}

Tests

import spock.lang.Specification

class AdderSpec extends Specification {
  def "Adder.add returns the sum"() {
    expect:
    assert Adder.add(1, 1) == 2
  }
}
import spock.lang.Specification

class AdderSpec extends Specification {
  def "Adder.add returns the sum"() {
    expect:
    assert Adder.add(1, 1) == 2
  }
}