How to Mock "this"

Bort

when I test a class's constructor there is an sentence like:

 SAPPublisherSvc server = new SAPPublisherSvc(sdkApp, this, curInt, factory, tidHandler);

I want to use PowerMock.expectNew(), but what can I fill to instead of the parameter this.

Bort

I have solved this problem ,here is what you should do:

PowerMock.expectNew(SAPPublisherSvc.class,EasyMock.same(app),EasyMock.isA(ServiceComponent.class) ,EasyMock.same(curInt),EasyMock.same(factory),EasyMock.same(tidHandler)).andReturn(server);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related