Loading ...
Sorry, an error occurred while loading the content.

1655Re: [easymock] nice mocks: verify a call does not happen

Expand Messages
  • Henri Tremblay
    Dec 7, 2011

      There's already a feature request about that. Unexpectedly, it's more complicated than I would want. You can also do
      expect(myobj.call()).andThrow(new AssertionError("Shouldn't be called"));


      On 8 December 2011 01:54, Chris Wright <dhasenan@...> wrote:

      I'm using easymock in a project, and for various reasons I'm using a
      nice mock in a particular test. However, I want to make sure that a
      particular call never happens.

      I tried calling:

      But easymock complained about this.

      The most succinct way I found of doing this is:
      expect(myobj.call()).andAnswer(new IAnswer<Object>() { public Object
      answer() throws Throwable { Assert.fail(); return null; } });

      Is there any easier way?

    • Show all 2 messages in this topic