I have a Sigleton class but how to use PoserMock to mock a private method in java?
Is there any sample?
public final class ApimSDKImpl implements ApimSDK {
/**
* init sdk
*/
private ApimSDKImpl() {}
/**
* set Singelton
*/
public static ApimSDKImpl getInstance() {
if (instance == null) {
synchronized (ApimSDKImpl.class) {
if (instance == null) {
instance = new ApimSDKImpl();
}
}
}
return instance;
}
/**
* setSystemConfig
*/
private String setSystemConfig() {
return "test";
}
}
how can I use PowerMock to Mock setSystemConfig function? thanks