I am not able to figure out partial mocking in groovy using gmock. I have the following code:
class Foo {
Integer val
Foo() {
this.val = 4;
}
Integer printHello() {
return getValue()
}
Integer getValue() {
return val+1;
}
}
and the testcase:
class FooTester {
@Test
void test() {
def lol = new Foo(4)
def mocker = mock(lol)
mocker.getValue().returns(5)
play {
assertEquals(5, lol.printHello())
}
}
}
I am referring to the documentation here. Assertion is failing with java.lang.AssertionError: Expectation not matched on verify:
What may the problem?