Tutorial example fails (maxInstances on @Capturing) #30

Closed
hamid-nazari opened this Issue Aug 7, 2014 · 3 comments

Comments

2 participants
@hamid-nazari

While reviewing the tutorial, I noticed that the test case on topic Specifying behavior for future instances fails with JMockit 1.9 and 1.10:

FAILED: testWithDifferentBehaviorForFirstNewInstanceAndRemainingNewInstances($Subclass_Buffer@6321e813, $Subclass_Buffer@6737fd8f)
java.lang.AssertionError: expected [10] but found [20]
    at tests.JMockitTests.testWithDifferentBehaviorForFirstNewInstanceAndRemainingNewInstances(JMockitTests.java:229)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:483)

It seems that the maxInstance=1 attribute on @Capturing is not in effect.

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Aug 8, 2014

Member

I am not seeing a failure with JMockit 1.9. Can you post the stack trace when running with this version? And the one with JMockit 1.10 too, if possible?

Member

rliesenfeld commented Aug 8, 2014

I am not seeing a failure with JMockit 1.9. Can you post the stack trace when running with this version? And the one with JMockit 1.10 too, if possible?

@rliesenfeld rliesenfeld self-assigned this Aug 8, 2014

@rliesenfeld rliesenfeld added the bug label Aug 8, 2014

@hamid-nazari

This comment has been minimized.

Show comment
Hide comment
@hamid-nazari

hamid-nazari Aug 8, 2014

The stack traces are the same for both versions, exactly like the one I've posted above. The assertion error is obviously for assertEquals(10, buffer1.position());. I'm getting curious. This is my environment:

JDK 1.8.0_11
eclipse Luna
TestNG 6.8.6.20141201_2240 (as eclipse plugin)
and JMockit 1.9 & 1.10

The stack traces are the same for both versions, exactly like the one I've posted above. The assertion error is obviously for assertEquals(10, buffer1.position());. I'm getting curious. This is my environment:

JDK 1.8.0_11
eclipse Luna
TestNG 6.8.6.20141201_2240 (as eclipse plugin)
and JMockit 1.9 & 1.10

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Aug 8, 2014

Member

I get no failure with 1.9, and a different failure with 1.10 (which I know why it happens, and how to handle it). It's probably a difference related to TestNG x JUnit, or Eclipse x IntelliJ.

Member

rliesenfeld commented Aug 8, 2014

I get no failure with 1.9, and a different failure with 1.10 (which I know why it happens, and how to handle it). It's probably a difference related to TestNG x JUnit, or Eclipse x IntelliJ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment