Navigation Menu

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

Set mock name in Mockito #259

Closed
johanhaleby opened this issue Jul 24, 2015 · 1 comment
Closed

Set mock name in Mockito #259

johanhaleby opened this issue Jul 24, 2015 · 1 comment

Comments

@johanhaleby
Copy link
Collaborator

From johan.ha...@gmail.com on March 15, 2010 13:24:33

I find that I get NullPointerExceptions when invoking toString() on
any mock objects generated by PowerMock. The following simple code
will re-create the problem:

import javax.crypto.Cipher;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

@RunWith(PowerMockRunner.class)
@PrepareForTest(Cipher.class)
public class MyTest {
private Cipher cipher;

@test
public void test1() throws Exception {
cipher = PowerMockito.mock(Cipher.class);

   System.out.println(cipher);

}
}

We use Log4j quite heavily to log method parameters and using injected
PowerMock objects makes this a big issue for us.

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

@johanhaleby
Copy link
Collaborator Author

From johan.ha...@gmail.com on March 15, 2010 10:24:29

Fixed in r1252

Summary: Set mock name in Mockito
Status: Fixed

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