ErrorsCatalogController extends AbstractOhfController { @RequestMapping(method = RequestMethod.GET, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.OK) @ResponseBody public List<ErrorsCatalogRpc> errorsCatalog() { final List<ErrorsCatalog> errorsCatalogList = errorCatalogService.getErrorCatalog(); final List<ErrorsCatalogRpc> result = new ArrayList<>(); for (ErrorsCatalog errorsCatalog : errorsCatalogList) { final ErrorExtEnum[] codes = errorsCatalog.getCodes(); final List<ErrorCodeRpc> resultCodes = new ArrayList<>(); for (ErrorExtEnum code : codes) { resultCodes.add(new ErrorCodeRpc(code.getErrorCode(), code.getErrDesc(), null)); } result.add(new ErrorsCatalogRpc(errorsCatalog.getName(), resultCodes)); } return result; }  @RequestMapping(method = RequestMethod.GET, produces = {"application/xml", "application/json"}) @ResponseStatus(HttpStatus.OK) @ResponseBody List<ErrorsCatalogRpc> errorsCatalog(); static final String REST_URI; }
@Test public void errorsCatalog() throws Exception { final URIBuilder uriBuilder = createGetUrl(ROOT_URI); mockMvc.perform(get(toUrl(uriBuilder)) .accept(MediaType.APPLICATION_JSON) .with(SecurityMockMvcRequestPostProcessors.authentication(mockAuthentication("ADMIN")))) .andExpect(status().isOk()) .andExpect(jsonPath("[0].name", is("OHF"))) .andExpect(jsonPath("[0].codes[0].code", is("E100"))) .andExpect(jsonPath("[0].codes[0].desc", is("unspecified error"))); }