### Question:
DeploymentNameRest extends AbstractRest { @GET @Produces(MediaType.APPLICATION_XML + ";qs=1") public Response getDeploymentXML(@PathParam("application_name") String applicationName, @PathParam("deployment_name") String deploymentName) { logger.info("GET request to path: /applications/" + applicationName + "/deploymentname/" + deploymentName + " [in JSON]"); Deployment deployment = deploymentDAO.getDeployment(deploymentName); String json = XMLBuilder.getDeploymentXML(deployment, applicationName); return buildResponse(Status.OK, json); }  @GET @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getDeploymentXML(@PathParam("application_name") String applicationName, @PathParam("deployment_name") String deploymentName); @GET @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getDeploymentJSON(@PathParam("application_name") String applicationName, @PathParam("deployment_name") String deploymentName);  }### Answer:
@Test public void getDeploymentTest() throws Exception { Deployment deployment = new Deployment(); deployment.setId(1); deployment.setOvf("ovf1"); deployment.setPrice("price1"); deployment.setStatus("Status1"); deployment.setDeploymentName("XXXX"); DeploymentDAO deploymentDAO = mock(DeploymentDAO.class); when(deploymentDAO.getDeployment("XXXX")).thenReturn(deployment); DeploymentNameRest deploymentRest = new DeploymentNameRest(); deploymentRest.deploymentDAO = deploymentDAO; Response response = deploymentRest.getDeploymentXML("2", "XXXX"); assertEquals(200, response.getStatus()); String xml = (String) response.getEntity(); JAXBContext jaxbContext = JAXBContext.newInstance(Deployment.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); deployment = (Deployment) jaxbUnmarshaller.unmarshal(new StringReader(xml)); assertEquals("/applications/2/deployments/1", deployment.getLinks().get(1).getHref()); assertEquals("self", deployment.getLinks().get(1).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment.getLinks().get(1).getType()); assertEquals("/applications/2/deployments", deployment.getLinks().get(0).getHref()); assertEquals("parent", deployment.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment.getLinks().get(0).getType()); assertEquals("/applications/2/deployments/1/ovf", deployment.getLinks().get(2).getHref()); assertEquals("ovf", deployment.getLinks().get(2).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment.getLinks().get(2).getType()); assertEquals("/applications/2/deployments/1/vms", deployment.getLinks().get(3).getHref()); assertEquals("vms", deployment.getLinks().get(3).getRel()); assertEquals(MediaType.APPLICATION_XML, deployment.getLinks().get(3).getType()); assertEquals("ovf1", deployment.getOvf()); assertEquals("price1", deployment.getPrice()); assertEquals("Status1", deployment.getStatus()); }