Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error mocking intter final class with PowerMock and Mockito #458

Open
johanhaleby opened this issue Jul 25, 2015 · 1 comment
Open

Comments

@johanhaleby
Copy link
Collaborator

From Svitlana...@gmail.com on April 07, 2013 18:01:53

What steps will reproduce the problem? 1. Create a class to test that calls remote REST endpoing using com.sun.jersey.api.client.WebResource: webResource.path("url").accept(MediaType.APPLICATION_XML_TYPE).get(String.class);
2. Create a unit test for that class with the @PrepareForTest Attribute
3. Run the test
4. Error occurs with "Invalid length XXXX in LocalVariableTable" What is the expected output? What do you see instead? It should not throw an exception What version of the product are you using? On what operating system? OS: Win7
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
org.mockito:mockito-all:1.9.5
org.powermock:powermock-api-mockito:1.5
org.powermock:powermock-module-junit4:1.5
junit:junit:4.8.2
com.sun.jersey:jersey-client:1.9.1:compile Please provide any additional information below. I tried also on Java(TM) SE Runtime Environment (build 1.6.0_33-b03) with the same result

Similar to https://code.google.com/p/powermock/issues/detail?id=266

Original issue: http://code.google.com/p/powermock/issues/detail?id=438

@johanhaleby
Copy link
Collaborator Author

From Maksym.F...@gmail.com on April 09, 2013 04:26:25

I faced the same issue when I was trying to mock WebResource.Builder class, which is public final inner in jersey-client 1.9.1. Finally I updated jersey to 1.17 where this class is not final any more. Not sure if PowerMock is able to mock final inner classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant