Wen I run my tests:
@RunWith(PowerMockRunner.class)
@PrepareForTest(MyStuff.class)
public class MyStuffTest { ..whatever
After I added ZonedDateTime
class to that code it stared failing with the following error:
java.lang.IllegalStateException: Failed to transform class with name MyCode Reason: [source error] toInstant() not found in java.time.ZonedDateTime
Somewhere in my code I have:
long longTimeNoSee = ZonedDateTime.parse(getateTimeString()).toInstant().toEpochMilli();
I guess it is a bug in powermock
. But maybe someone got some idea (?)
It seems to be a bug in Powermock indeed. See
https://github.com/jayway/powermock/issues/557
You might want to add your examples and vote for this issue.
UPDATE: According to Powermock it seems to be an issue in javassist: https://github.com/jboss-javassist/javassist/issues/43
Use powermockito version 1.6.6 or higher.
Also, make sure to use latest javassist version or at least 3.23.0-GA
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With