@Test
 public void testAddtag() throws Throwable {
   vm = vmDcpBackend.findById(vm.getId());
   int originalSize = vm.getTags().size();
   Tag tag = new Tag("namespace:predicate=value");
   vmDcpBackend.addTag(vm.getId(), tag);
   vm = vmDcpBackend.findById(vm.getId());
   assertThat(vm.getTags().size(), is(originalSize + 1));
   List<String> tagValues =
       vm.getTags().stream().map(t -> t.getValue()).collect(Collectors.toList());
   assertTrue(tagValues.contains(tag.getValue()));
 }
    @Test
    public void testAddTagWhenOriginalTagIsNull() throws Throwable {
      // overwriting the vmCreateSpec tags to empty from non-empty
      vmCreateSpec.setTags(null);

      createdVmTaskEntity = vmDcpBackend.prepareVmCreate(projectId, vmCreateSpec);
      vmId = createdVmTaskEntity.getEntityId();
      entityLockDcpBackend.clearTaskLocks(createdVmTaskEntity);
      vm = vmDcpBackend.findById(vmId);
      int originalSize = vm.getTags().size();
      Tag tag = new Tag("namespace:predicate=value");
      vmDcpBackend.addTag(vm.getId(), tag);
      vm = vmDcpBackend.findById(vm.getId());
      assertThat(vm.getTags().size(), is(1));
      List<String> tagValues =
          vm.getTags().stream().map(t -> t.getValue()).collect(Collectors.toList());
      assertTrue(tagValues.contains(tag.getValue()));
    }