Junit for CustomPageNameProvider
We have implemented the custom implementation for the java class CustomPageNameProvider referring below link,
And we are facing the challenges while implementing Junit for the CustomPageNameProvider for the below line,
Framework framework = context.getFramework();
Resource resource = context.getResource();
To get the context object in junit we have implemetated below line but we are unable to get the implementation object for the framework.
AnalyticsPageNameContext context = new AnalyticsPageNameContext(configuration, framework, resourceResolver, resource, "adobe", "/content/adobe");
We are looking any lead on the framework object on the Junit.
test case ,
Mockito.when(context.getFramework()).thenReturn(framework); // framework is throwing NullPointerException.
Mockito.when(context.getResource()).thenReturn(resource);
customPageNameProvider.getPageName(context);
Any lead would be highly appreciated.
Thanks,
Ramesh.