### Question:
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.nextTag(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); while (!reader.isEndElement()) { if (reader.getLocalName().equals(FormatXml.M_COUNT)) { readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT); } else { final String link = readLink(reader); links.add(link); } reader.nextTag(); } reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); return links; } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass() .getSimpleName()), e); } }  String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet); List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet);  }### Answer:
@Test public void readLinks() throws Exception { XMLStreamReader reader = createReaderForTest(MANAGER_1_EMPLOYEES, true); final List<String> links = new XmlLinkConsumer().readLinks(reader, null); assertEquals(4, links.size()); assertEquals(SERVICE_ROOT + "Employees('1')", links.get(0)); assertEquals(SERVICE_ROOT + "Employees('2')", links.get(1)); assertEquals(SERVICE_ROOT + "Employees('3')", links.get(2)); assertEquals(SERVICE_ROOT + "Employees('6')", links.get(3)); }
@Test public void readEmptyList() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><links xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\"/>"; final List<String> links = new XmlLinkConsumer().readLinks(createReaderForTest(xml, true), null); assertNotNull(links); assertTrue(links.isEmpty()); }
@Test public void readEmptyList2() throws Exception { final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<links xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\"></links>"; final List<String> links = new XmlLinkConsumer().readLinks(createReaderForTest(xml, true), null); assertNotNull(links); assertTrue(links.isEmpty()); }
@Test public void withInlineCount() throws Exception { final String xml = "<links xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">" + "<m:count xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">4</m:count>" + "<uri>" + SERVICE_ROOT + "Employees('5')</uri>" + "</links>"; final List<String> links = new XmlLinkConsumer().readLinks(createReaderForTest(xml, true), null); assertEquals(1, links.size()); }