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); }