@BeforeMethod
    public void setUp() throws Throwable {
      commonHostAndClientSetup(basicServiceHost, apiFeDcpRestClient);
      commonDataSetup(
          tenantDcpBackend,
          resourceTicketDcpBackend,
          projectDcpBackend,
          flavorDcpBackend,
          flavorLoader);

      commonVmAndImageSetup(vmDcpBackend, networkDcpBackend);

      vmId = createdVmTaskEntity.getEntityId();
      entityLockDcpBackend.clearTaskLocks(createdVmTaskEntity);
      vm = vmDcpBackend.findById(vmId);
    }
    @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()));
    }