@Test
  public void findNoneOfActiveVmsUsingNetworks() {
    mockDaos(true);

    List<String> vmNames =
        vmInterfaceManager.findActiveVmsUsingNetworks(
            Guid.newGuid(), Collections.singletonList(NETWORK_NAME + "1"));
    assertTrue(vmNames.isEmpty());
  }
  @Test
  public void findActiveVmsUsingNetworksOnUnpluggedVnic() {
    mockDaos(false);

    List<String> vmNames =
        vmInterfaceManager.findActiveVmsUsingNetworks(
            Guid.newGuid(), Collections.singletonList(NETWORK_NAME));
    assertFalse(vmNames.contains(VM_NAME));
  }
 protected void runAddAndVerify(
     VmNic iface,
     boolean reserveExistingMac,
     VerificationMode addMacVerification,
     int osId,
     Version version) {
   OsRepository osRepository = mock(OsRepository.class);
   when(vmInterfaceManager.getOsRepository()).thenReturn(osRepository);
   when(osRepository.hasNicHotplugSupport(any(Integer.class), any(Version.class)))
       .thenReturn(true);
   vmInterfaceManager.add(
       iface, NoOpCompensationContext.getInstance(), reserveExistingMac, osId, version);
   if (reserveExistingMac) {
     verify(macPoolManagerStrategy, times(1)).forceAddMac((iface.getMacAddress()));
   } else {
     verifyZeroInteractions(macPoolManagerStrategy);
   }
   verifyAddDelegatedCorrectly(iface, addMacVerification);
 }
  @Test
  public void removeAll() {
    List<VmNic> interfaces = Arrays.asList(createNewInterface(), createNewInterface());

    when(vmNicDao.getAllForVm(any(Guid.class))).thenReturn(interfaces);

    vmInterfaceManager.removeAll(Guid.newGuid());

    for (VmNic iface : interfaces) {
      verifyRemoveAllDelegatedCorrectly(iface);
    }
  }