Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial example fails (maxInstances on @Capturing) #30

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

Tutorial example fails (maxInstances on @Capturing) #30

hamid-nazari opened this issue Aug 7, 2014 · 3 comments
Assignees
Labels
bug

Comments

@hamid-nazari
Copy link

@hamid-nazari hamid-nazari commented Aug 7, 2014

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.

Copy link
Member

@rliesenfeld 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.

Copy link
Author

@hamid-nazari hamid-nazari commented 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

@rliesenfeld

This comment has been minimized.

Copy link
Member

@rliesenfeld 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
2 participants
You can’t perform that action at this time.