/** Tests reading a reference via web services. */
  public void testRead() throws Exception {
    ReadResult result =
        client.read(auth, new Identifier(referenceId, null, EntityTypeString.reference, null));
    assertOperationSuccess(result, EntityTypeString.reference);

    Asset asset = result.getAsset();
    assertNotNull(asset);

    Reference fetchedReference = asset.getReference();
    assertNotNull(fetchedReference);
    assertEquals(reference.getName(), fetchedReference.getName());
    assertEquals(referenceId, fetchedReference.getId());
    assertEquals(reference.getReferencedAssetId(), fetchedReference.getReferencedAssetId());
    assertEquals(reference.getReferencedAssetType(), fetchedReference.getReferencedAssetType());
    assertEquals(reference.getParentFolderId(), fetchedReference.getParentFolderId());
    assertEquals(reference.getSiteId(), fetchedReference.getSiteId());
  }
  /** Tests editing a reference via web services. */
  public void testEdit() throws Exception {
    Identifier referenceIdentifier =
        new Identifier(referenceId, null, EntityTypeString.reference, null);
    ReadResult result = client.read(auth, referenceIdentifier);
    Reference fetchedReference = result.getAsset().getReference();

    fetchedReference.setReferencedAssetId(folder2Id);
    fetchedReference.setReferencedAssetType(EntityTypeString.folder);

    OperationResult editResult = client.edit(auth, result.getAsset());
    assertOperationSuccess(editResult, EntityTypeString.reference);

    result = client.read(auth, referenceIdentifier);
    assertOperationSuccess(result, EntityTypeString.reference);

    Reference refetchedReference = result.getAsset().getReference();
    assertEquals(
        fetchedReference.getReferencedAssetId(), refetchedReference.getReferencedAssetId());
    assertEquals(
        fetchedReference.getReferencedAssetType(), refetchedReference.getReferencedAssetType());
    assertEquals(fetchedReference.getSiteId(), refetchedReference.getSiteId());
  }