### Question:
VersionResource extends ResourceBase { @GET @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF}) public Response get(final @Context ServletContext context, final @Context UriInfo uriInfo) { if (LOG.isDebugEnabled()) { LOG.debug("GET " + uriInfo.getAbsolutePath()); } servlet.getMetrics().incrementRequests(1); ResponseBuilder response = Response.ok(new VersionModel(context)); response.cacheControl(cacheControl); return response.build(); } VersionResource(); @GET @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF}) Response get(final @Context ServletContext context, 
      final @Context UriInfo uriInfo); @Path("cluster") StorageClusterVersionResource getClusterVersionResource(); @Path("rest") VersionResource getVersionResource();  }### Answer:
@Test public void testGetStargateVersionXML() throws IOException, JAXBException { Response response = client.get("/version", Constants.MIMETYPE_XML); assertTrue(response.getCode() == 200); VersionModel model = (VersionModel) context.createUnmarshaller().unmarshal( new ByteArrayInputStream(response.getBody())); validate(model); LOG.info("success retrieving Stargate version as XML"); }
@Test public void testGetStargateVersionJSON() throws IOException { Response response = client.get("/version", Constants.MIMETYPE_JSON); assertTrue(response.getCode() == 200); }
@Test public void testGetStargateVersionPB() throws IOException { Response response = client.get("/version", Constants.MIMETYPE_PROTOBUF); assertTrue(response.getCode() == 200); VersionModel model = new VersionModel(); model.getObjectFromMessage(response.getBody()); validate(model); LOG.info("success retrieving Stargate version as protobuf"); }
@Test public void testGetStorageClusterVersionText() throws IOException { Response response = client.get("/version/cluster", Constants.MIMETYPE_TEXT); assertTrue(response.getCode() == 200); }
@Test public void testGetStargateVersionText() throws IOException { Response response = client.get("/version", Constants.MIMETYPE_TEXT); assertTrue(response.getCode() == 200); String body = Bytes.toString(response.getBody()); assertTrue(body.length() > 0); assertTrue(body.contains(RESTServlet.VERSION_STRING)); assertTrue(body.contains(System.getProperty("java.vm.vendor"))); assertTrue(body.contains(System.getProperty("java.version"))); assertTrue(body.contains(System.getProperty("java.vm.version"))); assertTrue(body.contains(System.getProperty("os.name"))); assertTrue(body.contains(System.getProperty("os.version"))); assertTrue(body.contains(System.getProperty("os.arch"))); assertTrue(body.contains(ServletContainer.class.getPackage() .getImplementationVersion())); }
@Test public void testGetStorageClusterVersionXML() throws IOException, JAXBException { Response response = client.get("/version/cluster",Constants.MIMETYPE_XML); assertTrue(response.getCode() == 200); StorageClusterVersionModel clusterVersionModel = (StorageClusterVersionModel) context.createUnmarshaller().unmarshal( new ByteArrayInputStream(response.getBody())); assertNotNull(clusterVersionModel); assertNotNull(clusterVersionModel.getVersion()); LOG.info("success retrieving storage cluster version as XML"); }
@Test public void doTestGetStorageClusterVersionJSON() throws IOException { Response response = client.get("/version/cluster", Constants.MIMETYPE_JSON); assertTrue(response.getCode() == 200); }