### Question:
RestRequestParser { public RestRequestParser invoke() { String pathInfo = request.getPathInfo(); if (pathInfo == null || pathInfo.split("/").length < 3) { pathInfo = request.getServletPath(); } final String[] path = pathInfo.split("/"); if (path.length < 3) { throw new APIMalformedUrlException("Missing API or resource name [" + request.getRequestURL() + "]"); } apiName = path[1]; resourceName = path[2]; if (path.length > 3) { final List<String> pathList = Arrays.asList(path); resourceQualifiers = APIID.makeAPIID(pathList.subList(3, pathList.size())); } else { resourceQualifiers = null; } return this; } RestRequestParser(final HttpServletRequest request); String getApiName(); String getResourceName(); APIID getResourceQualifiers(); RestRequestParser invoke();  }### Answer:
@Test(expected = APIMalformedUrlException.class) public void should_parsePath_with_bad_request() { doReturn("API/bpm").when(httpServletRequest).getPathInfo(); doReturn("/API").when(httpServletRequest).getServletPath(); restRequestParser.invoke(); }