I have the following void method:
public void checkInvalidEarlyAccessKey(HippoBean hippoBean, HstRequest hstRequest, HstResponse hstResponse, HttpServletRequest request) {
if (StringUtils.isNotBlank(hippoBean.getSingleProperty(EARLY_ACCESS_KEY)) && !hippoBean.getSingleProperty(EARLY_ACCESS_KEY).equals(request.getParameter(PARAMETER_KEY))) {
LOGGER.debug("Early access key is set and null or wrong key is being used. Redirecting to 404 error code");
hstResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
HstResponseUtils.sendRedirect(hstRequest, hstResponse, ERROR_404_PATH);
}
}
How can I test this with Junit/Mockito? Should I test that the hstResponse status is indeed a 404 to ensure the if statement is true? Could you provide a code example? What is the best practice?
Thanks