I have final class and with constructor for that...
I have problem to mock this class. I came to know that i cannot use EasyMock for final class. But in my project i should use easymock only. Is there a way to mock this class? Can you please anyone help me in this?
//A a = createMock(A.class);//IllegalException occuring while running this test case
For example :
final class A {
private int a;
A(int a){
this.a = a;
}
}
It's impossible to mock a final class with pure EasyMock. You'll have to add in something like PowerMock, which integrates well with EasyMock. Or you write a test that doesn't require mocking of a final class.
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