RegistryResponseDescriptionExtractor { public List<String> getErrorCodes(RegistryResponseType response) { List<String> errorCodes = new ArrayList<>(); if (hasErrorList(response)) { errorCodes = Lists.transform(response.getRegistryErrorList().getRegistryError(), ERROR_EXTRACTOR); } return errorCodes; }  ImmutableList<String> getStatuses(RegistryResponseType response); List<String> getErrorCodes(RegistryResponseType response);  }
@Test public void errorResponse() { RegistryResponseType response = new RegistryResponseType(); RegistryError error = new RegistryError(); error.setErrorCode(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE); addError(response, error); error = new RegistryError(); error.setErrorCode(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE); addError(response, error); error = new RegistryError(); error.setErrorCode(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS); addError(response, error); RegistryResponseDescriptionExtractor extractor = new RegistryResponseDescriptionExtractor(); List<String> errorCodes = extractor.getErrorCodes(response); assertEquals(3, errorCodes.size()); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, errorCodes.get(0)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_FAILURE, errorCodes.get(1)); assertEquals(DocumentConstants.XDS_QUERY_RESPONSE_STATUS_PARTIAL_SUCCESS, errorCodes.get(2)); }