partial mock gmock 0.8

22 views
Skip to first unread message

Tapas Senapati

unread,
Sep 4, 2014, 2:04:33 AM9/4/14
to gmock...@googlegroups.com

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?

Johnny Jian

unread,
Sep 11, 2014, 10:27:41 PM9/11/14
to gmock...@googlegroups.com
Hi Tapas,

Looks like a bug to me, please raise an issue here: https://code.google.com/p/gmock/issues/list

Thanks.

Johnny
Reply all
Reply to author
Forward
0 new messages