vijayjcp / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 2 forks source link

Unit Test failures when running with the IBM JVM #444

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
When running the provided unit tests in module-test/mockito/junit4 with the IBM 
JVM, several tests fail. They work fine with the Oracle JVM.

What is the expected output? What do you see instead?
The expected output is that all tests pass.  They do pass with the Oracle JVM, 
the following failures occur when using the IBM JVM:
errorousVerificationOnPrivateMethodGivesFilteredErrorMessage(samples.powermockit
o.junit4.privatemocking.PrivateInstanceMockingTest): Two or more fields 
matching type java.lang.String.
  errorousVerificationOfStaticMethodsGivesANonMockitoStandardMessage(samples.powermockito.junit4.staticmocking.MockStaticTest): Two or more fields matching type java.lang.String.
  testMockStaticIncorrectTimes(samples.powermockito.junit4.staticmocking.MockStaticTest): Unexpected exception, expected<org.mockito.exceptions.verification.TooLittleActualInvocations> but was<org.powermock.reflect.exceptions.TooManyFieldsFoundException>
  verifyNoMoreInteractionsOnMethodThrowsAssertionErrorWhenMoreInteractionsTookPlace(samples.powermockito.junit4.verifynomoreinteractions.VerifyNoMoreInteractionsTest): Two or more fields matching type java.lang.String.
  verifyNoMoreInteractionsOnNewInstancesThrowsAssertionErrorWhenMoreInteractionsTookPlace(samples.powermockito.junit4.verifynomoreinteractions.VerifyNoMoreInteractionsTest): Two or more fields matching type java.lang.String.

What version of the product are you using? On what operating system?
OS: Win7 64-bit
JVM: IBM 1.6.0
PowerMock: 1.4.8 and 1.5
Maven: 2.2.1

Original issue reported on code.google.com by tjozwow...@gmail.com on 29 May 2013 at 8:45

GoogleCodeExporter commented 8 years ago
It would be great if you could help out and create a patch for this since I 
don't use the IBM JVM.

Original comment by johan.ha...@gmail.com on 10 Jun 2013 at 5:26

GoogleCodeExporter commented 8 years ago
Issue 514 has been merged into this issue.

Original comment by johan.ha...@gmail.com on 28 Aug 2014 at 11:29

GoogleCodeExporter commented 8 years ago
Hello,

This bug seems to be still occurring powermock-mockito-1.5.6 and a JRE 7 32bits 
IBM. Do you have any news about it?

Thanks

Original comment by gdel...@gmail.com on 25 Nov 2014 at 1:21

GoogleCodeExporter commented 8 years ago
I found you can download an Eclipse package from IBM[1] which includes the IBM 
JRE: IBM J9 VM (build 2.7, JRE 1.7.0).  Using this, the build from 
powermock-mockito-junit-1.6.0.zip, and the sample code I had in issue 514, I am 
able to reproduce the problem.

I'll see if I can build PowerMock from source and try to patch this.

[1]: IBM Download: http://www.ibm.com/developerworks/java/jdk/eclipse/

Original comment by mitchell...@gmail.com on 2 Dec 2014 at 6:10

GoogleCodeExporter commented 8 years ago
There are multiple ways of fixing the issue.  Here's one: 
https://github.com/mitchellmebane/powermock/commit/2569b1b53684537fb5bf2f0f47992
dc3dd57ed28

Should I add some specific tests for this?  Or are the existing tests enough?

Original comment by mitchell...@gmail.com on 3 Dec 2014 at 4:02