EasyMock
  1. EasyMock
  2. EASYMOCK-10

capture(Capture) only captures last method call

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: Core
    • Labels:
      None

      Description

      Code sample:

      SomeObject obj = createMock(SomeObject.class);

      Capture<Map> cap1 = new Capture();
      Capture<Map> cap2 = new Capture();

      obj.doSomething(eq("test"), capture(cap1));
      obj.doSomething(eq("anotherTest"), capture(cap2));

      replay(obj);

      obj.doSomethingToCauseMethodCalls();

      verify(obj);

      Problem:
      ================
      The object returned from cap1.getValue() == cap2.getValue(). Or - to be more precise - no matter which capture object you use the only value returned from getValue() will be the last captured value.

      Probably some static state thing but didn't seem like this is what you guys intended.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Henri Tremblay
            Reporter:
            Henri Tremblay
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: