public int doStartTag() throws JspException { pageContext.removeAttribute(TEMPLATE_PATH); SlingHttpServletRequest request = (SlingHttpServletRequest) pageContext.getRequest();
LOGGER.info("The view type passed from front end corresponding to which template "
+ "path is to be fetched is " + getView());
ComponentViewAndViewHelperCacheImpl componentViewAndViewHelperCacheImpl = new ComponentViewAndViewHelperCacheImpl();
String templatePath = "";
view = getView();
String resourcePath = WCMUtils.getComponent(request.getResource()).getResourceType();
}
How to do i write unit test case for above code using jmock , here pageContext is not a field of this class and it is not passed as parameter of the method, so i can not use setField() method to set value for pageContext neither i can pass pageContext as parameter so it gives null pointer exception when i try to write unit test case for this method at the line
pageContext.removeAttribute(TEMPLATE_PATH);
Any Help will be appreciated.
Aucun commentaire:
Enregistrer un commentaire