jmockit / jmockit1

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

mockit.internal.state.ExecutingTest.getOrCreateRecordAndReplay(ExecutingTest.java:50) #128

Closed evdzhan closed 9 years ago

evdzhan commented 9 years ago

Hello,

I am getting the following error :

Caused by: java.lang.IllegalStateException: Invalid place to record expectations at mockit.internal.state.ExecutingTest.getOrCreateRecordAndReplay(ExecutingTest.java:50) at my.package.MyClass_1. < init > (MyClass_1.java) at my.package.MyClass_1. < clinit > (MyClass_1.java:13) at my.package.MyClass_2. < clinit > (MyClass_2.java:150)

It says invalid place to record expectations, and it points to ExecutingTest.java:50 which is a jmockit internal file. I am indeed using expectations block, but the stack trace points to that mocking internal file.

Any clue about this ? I could develop sample case but it would take me good while...

My environment is Win7 64 bit JDK 1.7.0_51 32 bit JUnit 4 JMockit 1.14 (latest)

rliesenfeld commented 9 years ago

But where are you using the expectation block? It's only valid inside test methods and test setup methods. Anyway, without an example test I don't have a clue.