Bdxr201407Reader implements MetadataReader { @SuppressWarnings("all") @Override public List<ServiceReference> parseServiceGroup(FetcherResponse fetcherResponse) throws LookupException { try { Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); ServiceGroupType serviceGroup = unmarshaller.unmarshal( XmlUtils.streamReader(fetcherResponse.getInputStream()), ServiceGroupType.class).getValue(); List<ServiceReference> serviceReferences = new ArrayList<>(); for (ServiceMetadataReferenceType reference : serviceGroup.getServiceMetadataReferenceCollection().getServiceMetadataReference()) { String hrefDocumentTypeIdentifier = URLDecoder.decode(reference.getHref(), "UTF-8").split("/services/")[1]; String[] parts = hrefDocumentTypeIdentifier.split("::", 2); try { serviceReferences.add(ServiceReference.of(DocumentTypeIdentifierWithUri.of( parts[1], Scheme.of(parts[0]), URI.create(reference.getHref())))); } catch (ArrayIndexOutOfBoundsException e) { LOGGER.warn("Unable to parse '{}'.", hrefDocumentTypeIdentifier); } } return serviceReferences; } catch (JAXBException | XMLStreamException | UnsupportedEncodingException e) { throw new LookupException(e.getMessage(), e); } }  @SuppressWarnings("all") @Override List<ServiceReference> parseServiceGroup(FetcherResponse fetcherResponse); @SuppressWarnings("all") @Override PotentiallySigned<ServiceMetadata> parseServiceMetadata(FetcherResponse fetcherResponse);  }
@Test public void documentIdentifers() throws Exception { List<ServiceReference> result = reader.parseServiceGroup(new FetcherResponse( getClass().getResourceAsStream("/bdxr201407-servicegroup-9908-991825827.xml"), null)); assertEquals(result.size(), 7); }