Hot Posts

PowerMock and Java8 Streams

Java 8 Streams

Recently I was writing some units tests, as all good developers should, and ran into an issue with a test that made use of the IntStream of(int t) method. The test execution failed and throw the following exception:

java.lang.IllegalStateException: Failed to transform class with name com.readlearncode.ServiceTest. Reason: javassist.bytecode.InterfaceMethodrefInfo cannot be cast to javassist.bytecode.MethodrefInfo

After googling for the solution I found that others had had the same issue. A StackOverflow question and answer gave me the solution. As this is issue could cause someone quite a lot of pain I thought I would reproduce it below:


PowerMock has a dependency on javassist, exclude the transitive dependency in my POM and include the dependency separately.

Here is the POM snippet:








Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: