blob: fc0ae8fdaedd992df395646139334fe872421cdd [file] [log] [blame]
package groovy.mock.example
import groovy.mock.interceptor.MockFor
class SandwichMakerTest extends GroovyTestCase {
void testStuff(){
def mocker = new MockFor(CheeseSlicer.class)
mocker.demand.slice { name ->
assert name.startsWith("ch")
}
def sandwichMaker = new SandwichMaker()
mocker.use(sandwichMaker.cheeseSlicer) { // todo: should also work without giving the object!
sandwichMaker.makeFattySandwich()
}
}
}