private ActionDoc callApi(String method) throws Exception { ApiRequestParams params = ApiRequestParams.builder() .apiNs("Ext.ns") .actionNs("actionns") .group("doc") .configuration(configurationService.getConfiguration()) .build(); MockHttpServletRequestBuilder request = get("/api-debug-doc.js").accept(MediaType.ALL).characterEncoding("UTF-8"); request.param("apiNs", params.getApiNs()); request.param("actionNs", params.getActionNs()); request.param("group", params.getGroup()); MvcResult result = mockMvc .perform(request) .andExpect(status().isOk()) .andExpect(content().contentType("application/javascript")) .andReturn(); ApiControllerTest.compare(result, ApiControllerTest.groupApisWithDoc("actionns"), params); ActionDoc doc = getCommentForMethod(result.getResponse().getContentAsString(), method); return doc; }
private void doRequestWithoutDocs(String url) throws Exception { ApiRequestParams params = ApiRequestParams.builder() .apiNs("Ext.ns") .actionNs("actionns") .group("doc") .configuration(configurationService.getConfiguration()) .build(); MockHttpServletRequestBuilder request = get(url).accept(MediaType.ALL).characterEncoding("UTF-8"); request.param("apiNs", params.getApiNs()); request.param("actionNs", params.getActionNs()); request.param("group", params.getGroup()); MvcResult result = mockMvc .perform(request) .andExpect(status().isOk()) .andExpect(content().contentType("application/javascript")) .andReturn(); ApiControllerTest.compare(result, ApiControllerTest.groupApisWithDoc("actionns"), params); Assert.doesNotContain( "/**", result.getResponse().getContentAsString(), "generation of api.js should not contain method documentation"); }