@Test
    public void testToApiRepresentation() throws ExternalException {
      Vm foundVm = vmDcpBackend.toApiRepresentation(vmId);
      assertThat(foundVm.getName(), is(vm.name));

      assertThat(foundVm.getFlavor(), is(flavorEntity.getName()));
      assertThat(foundVm.getSourceImageId(), is(vm.imageId));
      assertThat(foundVm.getState(), is(vm.vmState));

      assertThat(foundVm.getAttachedIsos().get(0).getName(), is(vm.isos.get(0).getName()));
      assertThat(foundVm.getAttachedIsos().get(0).getSize(), is(vm.isos.get(0).getSize()));

      assertThat(foundVm.getMetadata().get("key1"), is(vm.metadata.get("key1")));

      assertThat(foundVm.getTags().containsAll(vm.tags), is(true));

      assertThat(foundVm.getHost(), is(vm.host));
      assertThat(foundVm.getDatastore(), is(vm.datastore));
      assertThat(foundVm.getProjectId(), is(vm.projectId));
    }