@Test
  public void testGETObjectAtPageVersion() throws Exception {
    Object objectToBePut = getObject("XWiki.TagClass");

    Map<String, String> versionToValueMap = new HashMap<String, String>();
    for (int i = 0; i < 5; i++) {
      String value = String.format("Value%d", i);

      Property property = getProperty(objectToBePut, "tags");
      property.setValue(value);

      PutMethod putMethod =
          executePutXml(
              getUriBuilder(ObjectResource.class)
                  .build(
                      getWiki(),
                      "Main",
                      "WebHome",
                      objectToBePut.getClassName(),
                      objectToBePut.getNumber())
                  .toString(),
              objectToBePut,
              "Admin",
              "admin");
      Assert.assertEquals(
          getHttpMethodInfo(putMethod), HttpStatus.SC_ACCEPTED, putMethod.getStatusCode());

      GetMethod getMethod =
          executeGet(
              getUriBuilder(PageResource.class).build(getWiki(), "Main", "WebHome").toString());
      Assert.assertEquals(
          getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

      Page page = (Page) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

      versionToValueMap.put(page.getVersion(), value);
    }

    for (String version : versionToValueMap.keySet()) {
      GetMethod getMethod =
          executeGet(
              getUriBuilder(ObjectAtPageVersionResource.class)
                  .build(
                      getWiki(),
                      "Main",
                      "WebHome",
                      version,
                      objectToBePut.getClassName(),
                      objectToBePut.getNumber())
                  .toString());
      Assert.assertEquals(
          getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());

      Object currentObject = (Object) unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

      Property property = getProperty(currentObject, "tags");

      Assert.assertEquals(versionToValueMap.get(version), property.getValue());

      checkLinks(currentObject);
      for (Property p : currentObject.getProperties()) {
        checkLinks(p);
      }
    }
  }
  public static Page createPage(
      ObjectFactory objectFactory,
      URI baseUri,
      URI self,
      Document doc,
      boolean useVersion,
      XWiki xwikiApi,
      Boolean withPrettyNames)
      throws XWikiException {
    Page page = objectFactory.createPage();
    fillPageSummary(page, objectFactory, baseUri, doc, useVersion, xwikiApi, withPrettyNames);

    page.setMajorVersion(doc.getRCSVersion().at(0));
    page.setMinorVersion(doc.getRCSVersion().at(1));
    page.setLanguage(doc.getLanguage());
    page.setCreator(doc.getCreator());
    if (withPrettyNames) {
      page.setCreatorName(xwikiApi.getUserName(doc.getCreator(), false));
    }

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(doc.getCreationDate());
    page.setCreated(calendar);

    page.setModifier(doc.getContentAuthor());
    if (withPrettyNames) {
      page.setModifierName(xwikiApi.getUserName(doc.getContentAuthor(), false));
    }

    calendar = Calendar.getInstance();
    calendar.setTime(doc.getContentUpdateDate());
    page.setModified(calendar);

    page.setComment(doc.getComment());
    page.setContent(doc.getContent());

    if (self != null) {
      Link pageLink = objectFactory.createLink();
      pageLink.setHref(self.toString());
      pageLink.setRel(Relations.SELF);
      page.getLinks().add(pageLink);
    }

    com.xpn.xwiki.api.Class xwikiClass = doc.getxWikiClass();
    if (xwikiClass != null) {
      String classUri = uri(baseUri, ClassResource.class, doc.getWiki(), xwikiClass.getName());
      Link classLink = objectFactory.createLink();
      classLink.setHref(classUri);
      classLink.setRel(Relations.CLASS);
      page.getLinks().add(classLink);
    }

    return page;
  }