Partial Mocking Problem

17 views
Skip to first unread message

Jozef Dransfield

unread,
Sep 15, 2009, 5:57:27 PM9/15/09
to gmock-user
if i have this test:

public class MehTest extends GMockTestCase {
def meh
void setUp() {
meh = new Meh()
}
void testDoSomething() {
ordered {
mock(meh).doSomethingElse()
}
play {
meh.doSomething()
}
}

The test passes when the code looks like this:

public class Meh {
void doSomething() {
doSomethingElse()
}
void doSomethingElse() {
throw new RuntimeException("Ruh oh")
}


But as soon as i move the doSomethingElse() call into a closure the
test throws a RuntimeException

public class Meh {
void doSomething() {
["a list"].each {
doSomethingElse()
}
}
void doSomethingElse() {
throw new RuntimeException("Ruh oh")
}





Johnny Jian

unread,
Sep 16, 2009, 5:57:01 AM9/16/09
to gmock...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages