jmockit / jmockit1

Advanced Java library for integration testing, mocking, faking, and code coverage
Other
465 stars 240 forks source link

mockit.internal.ClassFile$NotFoundException #71

Closed evdzhan closed 10 years ago

evdzhan commented 10 years ago

Hi there,

I am facing the following error when I try to mock an abstract class with JMockit 1.12. With JMockit 1.11 it works fine.

Enviroment :
OS Win7 64 bit JDK 1.7.0_51 32 bit JMockit 1.12

mockit.internal.ClassFile$NotFoundException: Unable to find class file for my.package.$Subclass_BaseWindow

The mockUp instantiation looks like :

new MockUp < BaseWindow > () { // override stuff here
};

Here is the entire stack trace mockit.internal.ClassFile$NotFoundException: Unable to find class file for my.package.$Subclass_BaseWindow at mockit.internal.ClassFile.verifyClassFileFound(ClassFile.java:35) at mockit.internal.ClassFile.readClassFromClasspath(ClassFile.java:101) at mockit.internal.ClassFile.readFromFile(ClassFile.java:144) at mockit.internal.ClassFile.createReaderFromLastRedefinitionIfAny(ClassFile.java:118) at mockit.internal.mockups.MockClassSetup.createClassReaderForRealClass(MockClassSetup.java:135) at mockit.internal.mockups.MockClassSetup.modifyRealClass(MockClassSetup.java:113) at mockit.internal.mockups.MockClassSetup.redefineMethodsInClassHierarchy(MockClassSetup.java:90) at mockit.internal.mockups.MockClassSetup.redefineMethods(MockClassSetup.java:78) at mockit.MockUp.redefineMethods(MockUp.java:253) at mockit.MockUp.redefineClassOrImplementInterface(MockUp.java:223) at mockit.MockUp.(MockUp.java:134)

rliesenfeld commented 10 years ago

How would I reproduce that exception? Can you show an example test?

evdzhan commented 10 years ago

The thing is I cannot recreate the failure in a sample case. I was hoping on you giving me an advice on when one would get this problem so I can fix it. Do you think this could be JMockit bug or rather my own code issue ?

rliesenfeld commented 10 years ago

I don't know.

charlouze commented 10 years ago

I found a way to reproduce this bug. Maybe I can send you a maven project that exposed this bug ?

rliesenfeld commented 10 years ago

Yes, paste the source files here if possible, or attach a zip file to a message in the JMockit Users group (https://groups.google.com/forum/#!forum/jmockit-users).

charlouze commented 10 years ago

done : https://groups.google.com/forum/#!topic/jmockit-users/iqCCr5hk69w

rliesenfeld commented 10 years ago

Thanks, the sample test does reproduce the problem.

charlouze commented 10 years ago

Did you see the other bug that happens with 1.11 ?