need help in writing junit test case for below code.
public class CanonicalURL extends WCMUsePojo {
public LinkCreator linkCreatorUtil;
public String path;
@9944223
public void activate() throws Exception {
linkCreatorUtil = getSlingScriptHelper().getService(LinkCreator.class);
path = get("path", String.class);
if (path == null) {
path = getCurrentPage().getPath();
}
}
can some one help in writing junit test case for this?
because mocking getSlingScriptHelper() is not working.
lenient().when(wcmUsePojo.getSlingScriptHelper()).thenReturn(slingScriptHelper);
lenient().when(slingScriptHelper.getService(LinkCreator.class)).thenReturn(linkCreator);