### Question:
Collection { public Items getItems() { return items; }  String getHref(); void setHref(String href); Items getItems(); void setItems(Items items); ArrayList<Link> getLinks(); void setLinks(ArrayList<Link> links); void addLink(Link link);  }### Answer:
@Test public void collectionOfExperiments() throws Exception { String collectionXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<collection xmlns=\"http: + "<items offset=\"0\" total=\"2\">" + "<application href=\"/101\">" + "<id>101</id>" + "<state>STATE1</state>" + "<deployment-plan-id>d1</deployment-plan-id>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/101\" type=\"application/xml\" />" + "</application>" + "<application href=\"/102\">" + "<id>102</id>" + "<state>STATE2</state>" + "<deployment-plan-id>d2</deployment-plan-id>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/102\" type=\"application/xml\" />" + "</application>" + "<deployment>" + "<id>11</id>" + "</deployment>" + "</items>" + "<link href=\"/\" rel=\"self\" type=\"application/xml\"/>" + "</collection>"; JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Collection collection = (Collection) jaxbUnmarshaller.unmarshal(new StringReader(collectionXML)); assertEquals(2, collection.getItems().getApplications().size()); assertEquals(102, collection.getItems().getApplications().get(1).getId()); assertEquals(1, collection.getItems().getDeployments().size()); }
@Test public void collectionOfExperiments() throws Exception { String testbedsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<collection xmlns=\"http: + "<items offset=\"0\" total=\"2\">" + "<provider href=\"/101\">" + "<id>101</id>" + "<name>provider1</name>" + "<endpoint>http1</endpoint>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/101\" type=\"application/xml\" />" + "</provider>" + "<provider href=\"/102\">" + "<id>102</id>" + "<name>provider2</name>" + "<endpoint>http2</endpoint>" + "<link rel=\"parent\" href=\"/\" type=\"application/xml\" />" + "<link rel=\"self\" href=\"/102\" type=\"application/xml\" />" + "</provider>" + "</items>" + "<link href=\"/\" rel=\"self\" type=\"application/xml\"/>" + "</collection>"; JAXBContext jaxbContext = JAXBContext.newInstance(Collection.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Collection collection = (Collection) jaxbUnmarshaller.unmarshal(new StringReader(testbedsXML)); assertEquals(2, collection.getItems().getProviders().size()); assertEquals(102, collection.getItems().getProviders().get(1).getId()); }