mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Upgrade to mockito 4 and handle Mockito deprecations (#8427)
This commit is contained in:
		
							parent
							
								
									37bb24f29e
								
							
						
					
					
						commit
						399bd0a067
					
				| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -21,7 +21,7 @@ import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.springframework.test.util.ReflectionTestUtils; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
|  | ||||
| @ -39,7 +39,7 @@ import org.springframework.test.util.ReflectionTestUtils; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.anyObject; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class AddObjectStoragePoolCmdTest { | ||||
| @ -65,9 +65,11 @@ public class AddObjectStoragePoolCmdTest { | ||||
| 
 | ||||
|     Map<String, String> details; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         details = new HashMap<>(); | ||||
|         addObjectStoragePoolCmdSpy = Mockito.spy(new AddObjectStoragePoolCmd()); | ||||
|         ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "name", name); | ||||
| @ -81,14 +83,15 @@ public class AddObjectStoragePoolCmdTest { | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         CallContext.unregister(); | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testAddObjectStore() throws DiscoveryException { | ||||
|         Mockito.doReturn(objectStore).when(storageService).discoverObjectStore(Mockito.anyString(), | ||||
|                 Mockito.anyString(), Mockito.anyString(), anyObject()); | ||||
|                 Mockito.anyString(), Mockito.anyString(), any()); | ||||
|         ObjectStoreResponse objectStoreResponse = new ObjectStoreResponse(); | ||||
|         Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(anyObject()); | ||||
|         Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(any()); | ||||
|         addObjectStoragePoolCmdSpy.execute(); | ||||
| 
 | ||||
|         Mockito.verify(storageService, Mockito.times(1)) | ||||
|  | ||||
| @ -37,9 +37,11 @@ public class DeleteObjectStoragePoolCmdTest { | ||||
|     @Spy | ||||
|     DeleteObjectStoragePoolCmd deleteObjectStoragePoolCmd; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         deleteObjectStoragePoolCmd = Mockito.spy(new DeleteObjectStoragePoolCmd()); | ||||
|         deleteObjectStoragePoolCmd._storageService = storageService; | ||||
|     } | ||||
| @ -47,6 +49,7 @@ public class DeleteObjectStoragePoolCmdTest { | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         CallContext.unregister(); | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.apache.cloudstack.api.response.StoragePoolResponse; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
| public class FindStoragePoolsForMigrationCmdTest { | ||||
|  | ||||
| @ -33,7 +33,7 @@ import org.mockito.MockitoAnnotations; | ||||
| import org.mockito.Spy; | ||||
| import org.springframework.test.util.ReflectionTestUtils; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.anyObject; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| 
 | ||||
| public class UpdateObjectStoragePoolCmdTest { | ||||
|     public static final Logger s_logger = Logger.getLogger(UpdateObjectStoragePoolCmdTest.class.getName()); | ||||
| @ -56,9 +56,11 @@ public class UpdateObjectStoragePoolCmdTest { | ||||
| 
 | ||||
|     private String provider = "Simulator"; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         updateObjectStoragePoolCmd = Mockito.spy(new UpdateObjectStoragePoolCmd()); | ||||
|         updateObjectStoragePoolCmd._storageService = storageService; | ||||
|         updateObjectStoragePoolCmd._responseGenerator = responseGenerator; | ||||
| @ -70,13 +72,14 @@ public class UpdateObjectStoragePoolCmdTest { | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         CallContext.unregister(); | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testUpdateObjectStore() { | ||||
|         Mockito.doReturn(objectStore).when(storageService).updateObjectStore(1L, updateObjectStoragePoolCmd); | ||||
|         ObjectStoreResponse objectStoreResponse = new ObjectStoreResponse(); | ||||
|         Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(anyObject()); | ||||
|         Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(any()); | ||||
|         updateObjectStoragePoolCmd.execute(); | ||||
|         Mockito.verify(storageService, Mockito.times(1)) | ||||
|                 .updateObjectStore(1L, updateObjectStoragePoolCmd); | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.junit.Before; | ||||
| import org.junit.Rule; | ||||
| import org.junit.Test; | ||||
| import org.junit.rules.ExpectedException; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| 
 | ||||
| import org.apache.cloudstack.api.command.user.project.ActivateProjectCmd; | ||||
| @ -57,7 +57,7 @@ public class ActivateProjectCmdTest extends TestCase { | ||||
|     @Test | ||||
|     public void testGetEntityOwnerIdForNullProject() { | ||||
|         ProjectService projectService = Mockito.mock(ProjectService.class); | ||||
|         Mockito.when(projectService.getProject(Matchers.anyLong())).thenReturn(null); | ||||
|         Mockito.when(projectService.getProject(ArgumentMatchers.anyLong())).thenReturn(null); | ||||
|         activateProjectCmd._projectService = projectService; | ||||
| 
 | ||||
|         try { | ||||
| @ -74,9 +74,9 @@ public class ActivateProjectCmdTest extends TestCase { | ||||
|         ProjectService projectService = Mockito.mock(ProjectService.class); | ||||
|         Account account = Mockito.mock(Account.class); | ||||
|         Mockito.when(account.getId()).thenReturn(2L); | ||||
|         Mockito.when(projectService.getProject(Matchers.anyLong())).thenReturn(project); | ||||
|         Mockito.when(projectService.getProject(ArgumentMatchers.anyLong())).thenReturn(project); | ||||
| 
 | ||||
|         Mockito.when(projectService.getProjectOwner(Matchers.anyLong())).thenReturn(account); | ||||
|         Mockito.when(projectService.getProjectOwner(ArgumentMatchers.anyLong())).thenReturn(account); | ||||
|         activateProjectCmd._projectService = projectService; | ||||
| 
 | ||||
|         Assert.assertEquals(2L, activateProjectCmd.getEntityOwnerId()); | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.junit.Before; | ||||
| import org.junit.Rule; | ||||
| import org.junit.Test; | ||||
| import org.junit.rules.ExpectedException; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| 
 | ||||
| import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd; | ||||
| @ -101,9 +101,9 @@ public class AddAccountToProjectCmdTest extends TestCase { | ||||
|         Account account = Mockito.mock(Account.class); | ||||
| 
 | ||||
|         Mockito.when(account.getId()).thenReturn(2L); | ||||
|         Mockito.when(projectService.getProject(Matchers.anyLong())).thenReturn(project); | ||||
|         Mockito.when(projectService.getProject(ArgumentMatchers.anyLong())).thenReturn(project); | ||||
| 
 | ||||
|         Mockito.when(projectService.getProjectOwner(Matchers.anyLong())).thenReturn(account); | ||||
|         Mockito.when(projectService.getProjectOwner(ArgumentMatchers.anyLong())).thenReturn(account); | ||||
|         addAccountToProjectCmd._projectService = projectService; | ||||
| 
 | ||||
|         Assert.assertEquals(2L, addAccountToProjectCmd.getEntityOwnerId()); | ||||
|  | ||||
| @ -21,7 +21,7 @@ import junit.framework.TestCase; | ||||
| 
 | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.apache.cloudstack.api.ResponseGenerator; | ||||
| import org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd; | ||||
| @ -59,7 +59,7 @@ public class AddIpToVmNicTest extends TestCase { | ||||
|         NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class); | ||||
| 
 | ||||
|         Mockito.when( | ||||
|             networkService.allocateSecondaryGuestIP(Matchers.anyLong(), Matchers.any())) | ||||
|             networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any())) | ||||
|             .thenReturn(secIp); | ||||
| 
 | ||||
|         ipTonicCmd._networkService = networkService; | ||||
| @ -79,7 +79,7 @@ public class AddIpToVmNicTest extends TestCase { | ||||
|         AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class); | ||||
| 
 | ||||
|         Mockito.when( | ||||
|             networkService.allocateSecondaryGuestIP(Matchers.anyLong(), Matchers.any())) | ||||
|             networkService.allocateSecondaryGuestIP(ArgumentMatchers.anyLong(), ArgumentMatchers.any())) | ||||
|             .thenReturn(null); | ||||
| 
 | ||||
|         ipTonicCmd._networkService = networkService; | ||||
| @ -98,7 +98,7 @@ public class AddIpToVmNicTest extends TestCase { | ||||
|         NetworkService networkService = Mockito.mock(NetworkService.class); | ||||
|         RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class); | ||||
| 
 | ||||
|         Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(true); | ||||
|         Mockito.when(networkService.releaseSecondaryIpFromNic(ArgumentMatchers.anyInt())).thenReturn(true); | ||||
| 
 | ||||
|         removeIpFromNic._networkService = networkService; | ||||
|         removeIpFromNic.execute(); | ||||
| @ -109,7 +109,7 @@ public class AddIpToVmNicTest extends TestCase { | ||||
|         NetworkService networkService = Mockito.mock(NetworkService.class); | ||||
|         RemoveIpFromVmNicCmd removeIpFromNic = Mockito.mock(RemoveIpFromVmNicCmd.class); | ||||
| 
 | ||||
|         Mockito.when(networkService.releaseSecondaryIpFromNic(Matchers.anyInt())).thenReturn(false); | ||||
|         Mockito.when(networkService.releaseSecondaryIpFromNic(ArgumentMatchers.anyInt())).thenReturn(false); | ||||
| 
 | ||||
|         removeIpFromNic._networkService = networkService; | ||||
|         successResponseGenerator = Mockito.mock(SuccessResponse.class); | ||||
|  | ||||
| @ -26,7 +26,7 @@ import org.junit.Before; | ||||
| import org.junit.Rule; | ||||
| import org.junit.Test; | ||||
| import org.junit.rules.ExpectedException; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| 
 | ||||
| import org.apache.cloudstack.api.ServerApiException; | ||||
| @ -86,7 +86,7 @@ public class AddNetworkServiceProviderCmdTest extends TestCase { | ||||
|         addNetworkServiceProviderCmd._networkService = networkService; | ||||
| 
 | ||||
|         PhysicalNetworkServiceProvider physicalNetworkServiceProvider = Mockito.mock(PhysicalNetworkServiceProvider.class); | ||||
|         Mockito.when(networkService.addProviderToPhysicalNetwork(Matchers.anyLong(), Matchers.anyString(), Matchers.anyLong(), Matchers.anyList())).thenReturn( | ||||
|         Mockito.when(networkService.addProviderToPhysicalNetwork(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyLong(), ArgumentMatchers.anyList())).thenReturn( | ||||
|             physicalNetworkServiceProvider); | ||||
| 
 | ||||
|         try { | ||||
| @ -103,7 +103,7 @@ public class AddNetworkServiceProviderCmdTest extends TestCase { | ||||
|         NetworkService networkService = Mockito.mock(NetworkService.class); | ||||
|         addNetworkServiceProviderCmd._networkService = networkService; | ||||
| 
 | ||||
|         Mockito.when(networkService.addProviderToPhysicalNetwork(Matchers.anyLong(), Matchers.anyString(), Matchers.anyLong(), Matchers.anyList())).thenReturn(null); | ||||
|         Mockito.when(networkService.addProviderToPhysicalNetwork(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyLong(), ArgumentMatchers.anyList())).thenReturn(null); | ||||
| 
 | ||||
|         try { | ||||
|             addNetworkServiceProviderCmd.create(); | ||||
|  | ||||
| @ -18,7 +18,7 @@ package org.apache.cloudstack.api.command.test; | ||||
| 
 | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyObject; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| 
 | ||||
| @ -86,7 +86,7 @@ public class AddSecondaryStorageCmdTest extends TestCase { | ||||
|         StorageService resourceService = Mockito.mock(StorageService.class); | ||||
|         addImageStoreCmd._storageService = resourceService; | ||||
| 
 | ||||
|         Mockito.when(resourceService.discoverImageStore(anyString(), anyString(), anyString(), anyLong(), (Map)anyObject())) | ||||
|         Mockito.when(resourceService.discoverImageStore(anyString(), anyString(), anyString(), anyLong(), (Map)any())) | ||||
|                 .thenReturn(null); | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -17,10 +17,10 @@ | ||||
| package org.apache.cloudstack.api.command.test; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.anyObject; | ||||
| import static org.mockito.Matchers.anyString; | ||||
| import static org.mockito.Matchers.isNull; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.isNull; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| @ -126,7 +126,7 @@ public class CreateSnapshotCmdTest extends TestCase { | ||||
| 
 | ||||
|         try { | ||||
|                 Mockito.when(volumeApiService.takeSnapshot(nullable(Long.class), nullable(Long.class), nullable(Long.class), | ||||
|                         nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), anyObject(), Mockito.anyList())).thenReturn(null); | ||||
|                         nullable(Account.class), nullable(Boolean.class), nullable(Snapshot.LocationType.class), nullable(Boolean.class), any(), Mockito.anyList())).thenReturn(null); | ||||
|         } catch (Exception e) { | ||||
|             Assert.fail("Received exception when success expected " + e.getMessage()); | ||||
|         } | ||||
|  | ||||
| @ -21,7 +21,7 @@ import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.springframework.test.util.ReflectionTestUtils; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
|  | ||||
| @ -21,7 +21,7 @@ import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.springframework.test.util.ReflectionTestUtils; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
|  | ||||
| @ -28,7 +28,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
|  | ||||
| @ -26,7 +26,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
|  | ||||
| @ -29,7 +29,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| @RunWith(MockitoJUnitRunner.class) | ||||
|  | ||||
| @ -29,7 +29,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.springframework.test.util.ReflectionTestUtils; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| @ -23,6 +23,7 @@ import com.cloud.utils.db.EntityManager; | ||||
| import com.cloud.vm.VirtualMachine; | ||||
| import org.apache.cloudstack.api.response.VMScheduleResponse; | ||||
| import org.apache.cloudstack.vm.schedule.VMScheduleManager; | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -41,9 +42,16 @@ public class CreateVMScheduleCmdTest { | ||||
|     @InjectMocks | ||||
|     private CreateVMScheduleCmd createVMScheduleCmd = new CreateVMScheduleCmd(); | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -25,6 +25,7 @@ import org.apache.cloudstack.api.ServerApiException; | ||||
| import org.apache.cloudstack.api.response.SuccessResponse; | ||||
| import org.apache.cloudstack.vm.schedule.VMSchedule; | ||||
| import org.apache.cloudstack.vm.schedule.VMScheduleManager; | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -44,9 +45,16 @@ public class DeleteVMScheduleCmdTest { | ||||
|     @InjectMocks | ||||
|     private DeleteVMScheduleCmd deleteVMScheduleCmd = new DeleteVMScheduleCmd(); | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -21,6 +21,7 @@ package org.apache.cloudstack.api.command.user.vm; | ||||
| import org.apache.cloudstack.api.response.ListResponse; | ||||
| import org.apache.cloudstack.api.response.VMScheduleResponse; | ||||
| import org.apache.cloudstack.vm.schedule.VMScheduleManager; | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -38,10 +39,16 @@ public class ListVMScheduleCmdTest { | ||||
|     public VMScheduleManager vmScheduleManager; | ||||
|     @InjectMocks | ||||
|     private ListVMScheduleCmd listVMScheduleCmd = new ListVMScheduleCmd(); | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -24,6 +24,7 @@ import com.cloud.vm.VirtualMachine; | ||||
| import org.apache.cloudstack.api.response.VMScheduleResponse; | ||||
| import org.apache.cloudstack.vm.schedule.VMSchedule; | ||||
| import org.apache.cloudstack.vm.schedule.VMScheduleManager; | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -42,9 +43,16 @@ public class UpdateVMScheduleCmdTest { | ||||
|     @InjectMocks | ||||
|     private UpdateVMScheduleCmd updateVMScheduleCmd = new UpdateVMScheduleCmd(); | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -28,7 +28,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.user.Account; | ||||
| import com.cloud.user.User; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -27,7 +27,7 @@ import java.util.Vector; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.agent.api.SecurityGroupRulesCmd.IpPortAndProto; | ||||
| 
 | ||||
|  | ||||
| @ -27,6 +27,7 @@ import org.apache.http.client.methods.HttpGet; | ||||
| import org.apache.http.client.methods.HttpHead; | ||||
| import org.apache.http.impl.client.CloseableHttpClient; | ||||
| import org.apache.http.message.BasicStatusLine; | ||||
| import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| @ -58,9 +59,11 @@ public class BaseDirectTemplateDownloaderTest { | ||||
|     @InjectMocks | ||||
|     protected HttpsDirectTemplateDownloader httpsDownloader = new HttpsDirectTemplateDownloader(httpUrl, 1000, 1000, 1000); | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void init() throws IOException { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         Mockito.when(httpsClient.execute(Mockito.any(HttpGet.class))).thenReturn(response); | ||||
|         Mockito.when(httpsClient.execute(Mockito.any(HttpHead.class))).thenReturn(response); | ||||
|         StatusLine statusLine = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK"); | ||||
| @ -69,4 +72,9 @@ public class BaseDirectTemplateDownloaderTest { | ||||
|         ByteArrayInputStream inputStream = new ByteArrayInputStream(httpMetalinkContent.getBytes(StandardCharsets.UTF_8)); | ||||
|         Mockito.when(httpEntity.getContent()).thenReturn(inputStream); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -22,7 +22,7 @@ import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.resource.ServerResource; | ||||
| 
 | ||||
|  | ||||
| @ -742,7 +742,7 @@ public class VirtualMachineManagerImplTest { | ||||
|         List<Volume> volumesNotMapped = new ArrayList<>(); | ||||
| 
 | ||||
|         Mockito.doReturn(volumeToPoolObjectMap).when(virtualMachineManagerImpl).buildMapUsingUserInformation(Mockito.eq(virtualMachineProfileMock), Mockito.eq(hostMock), | ||||
|                 Mockito.anyMapOf(Long.class, Long.class)); | ||||
|                 Mockito.anyMap()); | ||||
| 
 | ||||
|         Mockito.doReturn(volumesNotMapped).when(virtualMachineManagerImpl).findVolumesThatWereNotMappedByTheUser(virtualMachineProfileMock, volumeToPoolObjectMap); | ||||
|         Mockito.doNothing().when(virtualMachineManagerImpl).createStoragePoolMappingsForVolumes(Mockito.eq(virtualMachineProfileMock), | ||||
| @ -753,7 +753,7 @@ public class VirtualMachineManagerImplTest { | ||||
|         assertEquals(mappingVolumeAndStoragePool, volumeToPoolObjectMap); | ||||
| 
 | ||||
|         InOrder inOrder = Mockito.inOrder(virtualMachineManagerImpl); | ||||
|         inOrder.verify(virtualMachineManagerImpl).buildMapUsingUserInformation(Mockito.eq(virtualMachineProfileMock), Mockito.eq(hostMock), Mockito.anyMapOf(Long.class, Long.class)); | ||||
|         inOrder.verify(virtualMachineManagerImpl).buildMapUsingUserInformation(Mockito.eq(virtualMachineProfileMock), Mockito.eq(hostMock), Mockito.anyMap()); | ||||
|         inOrder.verify(virtualMachineManagerImpl).findVolumesThatWereNotMappedByTheUser(virtualMachineProfileMock, volumeToPoolObjectMap); | ||||
|         inOrder.verify(virtualMachineManagerImpl).createStoragePoolMappingsForVolumes(Mockito.eq(virtualMachineProfileMock), | ||||
|                 any(DataCenterDeployment.class), Mockito.eq(volumeToPoolObjectMap), Mockito.eq(volumesNotMapped)); | ||||
|  | ||||
| @ -38,7 +38,7 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.junit.runners.JUnit4; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| 
 | ||||
| import com.cloud.api.query.dao.DomainRouterJoinDao; | ||||
| @ -137,7 +137,7 @@ public class NetworkOrchestratorTest extends TestCase { | ||||
|         when(provider.getCapabilities()).thenReturn(services); | ||||
|         capabilities.put(Network.Capability.DhcpAccrossMultipleSubnets, "true"); | ||||
| 
 | ||||
|         when(testOrchastrator._ntwkSrvcDao.getProviderForServiceInNetwork(Matchers.anyLong(), Matchers.eq(Service.Dhcp))).thenReturn(dhcpProvider); | ||||
|         when(testOrchastrator._ntwkSrvcDao.getProviderForServiceInNetwork(ArgumentMatchers.anyLong(), ArgumentMatchers.eq(Service.Dhcp))).thenReturn(dhcpProvider); | ||||
|         when(testOrchastrator._networkModel.getElementImplementingProvider(dhcpProvider)).thenReturn(provider); | ||||
| 
 | ||||
|         when(guru.getName()).thenReturn(guruName); | ||||
|  | ||||
| @ -20,7 +20,6 @@ | ||||
| package org.apache.cloudstack.engine.provisioning.test; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| import junit.framework.TestCase; | ||||
| 
 | ||||
| @ -30,11 +29,10 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; | ||||
| import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; | ||||
| @ -51,7 +49,6 @@ import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; | ||||
| import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; | ||||
| import org.apache.cloudstack.engine.service.api.ProvisioningService; | ||||
| 
 | ||||
| import com.cloud.dc.DataCenter.NetworkType; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| 
 | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -17,6 +17,7 @@ | ||||
| 
 | ||||
| package com.cloud.offerings.dao; | ||||
| 
 | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -37,9 +38,16 @@ public class NetworkOfferingDaoImplTest { | ||||
| 
 | ||||
|     final long offeringId = 1L; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setup() { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|  | ||||
| @ -21,7 +21,7 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| @ -72,7 +72,7 @@ public class StoragePoolTagsDaoImplTest extends TestCase { | ||||
|     public void setup() { | ||||
|         when(_configDao.getValue(batchSizeConfigurationKey)).thenReturn(batchSizeValue); | ||||
|         doReturn(storagePoolTagList).when(_storagePoolTagsDaoImpl).searchIncludingRemoved( | ||||
|                 Matchers.any(SearchCriteria.class), Matchers.isNull(Filter.class), Matchers.isNull(Boolean.class), Matchers.eq(false)); | ||||
|                 ArgumentMatchers.any(SearchCriteria.class), ArgumentMatchers.isNull(Filter.class), ArgumentMatchers.isNull(Boolean.class), ArgumentMatchers.eq(false)); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
| @ -91,7 +91,7 @@ public class StoragePoolTagsDaoImplTest extends TestCase { | ||||
|         List<StoragePoolTagVO> storagePoolTags = new ArrayList<StoragePoolTagVO>(); | ||||
| 
 | ||||
|         _storagePoolTagsDaoImpl.searchForStoragePoolIdsInternal(0, storageTagsIds.length, storageTagsIds, storagePoolTags); | ||||
|         verify(_storagePoolTagsDaoImpl).searchIncludingRemoved(Matchers.any(SearchCriteria.class), Matchers.isNull(Filter.class), Matchers.isNull(Boolean.class), Matchers.eq(false)); | ||||
|         verify(_storagePoolTagsDaoImpl).searchIncludingRemoved(ArgumentMatchers.any(SearchCriteria.class), ArgumentMatchers.isNull(Filter.class), ArgumentMatchers.isNull(Boolean.class), ArgumentMatchers.eq(false)); | ||||
|         assertEquals(2, storagePoolTags.size()); | ||||
|     } | ||||
| 
 | ||||
| @ -99,30 +99,30 @@ public class StoragePoolTagsDaoImplTest extends TestCase { | ||||
|     public void testSearchForStoragePoolIdsInternalStorageTagsNullSearch() { | ||||
|         List<StoragePoolTagVO> storagePoolTags = new ArrayList<StoragePoolTagVO>(); | ||||
|         doReturn(null).when(_storagePoolTagsDaoImpl).searchIncludingRemoved( | ||||
|                 Matchers.any(SearchCriteria.class), Matchers.isNull(Filter.class), Matchers.isNull(Boolean.class), Matchers.eq(false)); | ||||
|                 ArgumentMatchers.any(SearchCriteria.class), ArgumentMatchers.isNull(Filter.class), ArgumentMatchers.isNull(Boolean.class), ArgumentMatchers.eq(false)); | ||||
| 
 | ||||
|         _storagePoolTagsDaoImpl.searchForStoragePoolIdsInternal(0, storageTagsIds.length, storageTagsIds, storagePoolTags); | ||||
|         verify(_storagePoolTagsDaoImpl).searchIncludingRemoved(Matchers.any(SearchCriteria.class), Matchers.isNull(Filter.class), Matchers.isNull(Boolean.class), Matchers.eq(false)); | ||||
|         verify(_storagePoolTagsDaoImpl).searchIncludingRemoved(ArgumentMatchers.any(SearchCriteria.class), ArgumentMatchers.isNull(Filter.class), ArgumentMatchers.isNull(Boolean.class), ArgumentMatchers.eq(false)); | ||||
|         assertEquals(0, storagePoolTags.size()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testSearchByIdsStorageTagsIdsGreaterOrEqualThanBatchSize() { | ||||
|         when(_configDao.getValue(batchSizeConfigurationKey)).thenReturn(batchSizeLow); | ||||
|         doNothing().when(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(Matchers.anyInt(), Matchers.anyInt(), Matchers.any(Long[].class), Matchers.anyList()); | ||||
|         doNothing().when(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt(), ArgumentMatchers.any(Long[].class), ArgumentMatchers.anyList()); | ||||
|         _storagePoolTagsDaoImpl.searchByIds(storageTagsIds); | ||||
| 
 | ||||
|         int batchSize = Integer.parseInt(batchSizeLow); | ||||
|         int difference = storageTagsIds.length - 2 * batchSize; | ||||
|         verify(_storagePoolTagsDaoImpl, Mockito.times(2)).searchForStoragePoolIdsInternal(Matchers.anyInt(), Matchers.eq(batchSize), Matchers.any(Long[].class), Matchers.anyList()); | ||||
|         verify(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(Matchers.eq(2 * batchSize), Matchers.eq(difference), Matchers.any(Long[].class), Matchers.anyList()); | ||||
|         verify(_storagePoolTagsDaoImpl, Mockito.times(2)).searchForStoragePoolIdsInternal(ArgumentMatchers.anyInt(), ArgumentMatchers.eq(batchSize), ArgumentMatchers.any(Long[].class), ArgumentMatchers.anyList()); | ||||
|         verify(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(ArgumentMatchers.eq(2 * batchSize), ArgumentMatchers.eq(difference), ArgumentMatchers.any(Long[].class), ArgumentMatchers.anyList()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testSearchByIdsStorageTagsIdsLowerThanBatchSize() { | ||||
|         doNothing().when(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(Matchers.anyInt(), Matchers.anyInt(), Matchers.any(Long[].class), Matchers.anyList()); | ||||
|         doNothing().when(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt(), ArgumentMatchers.any(Long[].class), ArgumentMatchers.anyList()); | ||||
|         _storagePoolTagsDaoImpl.searchByIds(storageTagsIds); | ||||
| 
 | ||||
|         verify(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(Matchers.eq(0), Matchers.eq(storageTagsIds.length), Matchers.any(Long[].class), Matchers.anyList()); | ||||
|         verify(_storagePoolTagsDaoImpl).searchForStoragePoolIdsInternal(ArgumentMatchers.eq(0), ArgumentMatchers.eq(storageTagsIds.length), ArgumentMatchers.any(Long[].class), ArgumentMatchers.anyList()); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -17,7 +17,7 @@ | ||||
| 
 | ||||
| package com.cloud.usage.dao; | ||||
| 
 | ||||
| import static org.mockito.Matchers.contains; | ||||
| import static org.mockito.ArgumentMatchers.contains; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
| import static org.mockito.Mockito.when; | ||||
|  | ||||
| @ -20,6 +20,7 @@ package com.cloud.vm.dao; | ||||
| import com.cloud.utils.Pair; | ||||
| import com.cloud.vm.VirtualMachine; | ||||
| import org.joda.time.DateTime; | ||||
| import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.Assert; | ||||
| @ -45,15 +46,22 @@ public class VMInstanceDaoImplTest { | ||||
|     @Mock | ||||
|     VMInstanceVO vm; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         Long hostId = null; | ||||
|         when(vm.getHostId()).thenReturn(hostId); | ||||
|         when(vm.getUpdated()).thenReturn(5L); | ||||
|         when(vm.getUpdateTime()).thenReturn(DateTime.now().toDate()); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testUpdateState() throws Exception { | ||||
|         Long destHostId = null; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -131,7 +131,7 @@ public class ConfigDriveBuilderTest { | ||||
| 
 | ||||
|             configDriveBuilderMocked.when(() -> ConfigDriveBuilder.writeVendorAndNetworkEmptyJsonFile(Mockito.any(File.class))).then(invocationOnMock -> null); | ||||
| 
 | ||||
|             configDriveBuilderMocked.when(() -> ConfigDriveBuilder.writeVmMetadata(Mockito.anyListOf(String[].class), Mockito.anyString(), Mockito.any(File.class), anyMap())).then(invocationOnMock -> null); | ||||
|             configDriveBuilderMocked.when(() -> ConfigDriveBuilder.writeVmMetadata(Mockito.anyList(), Mockito.anyString(), Mockito.any(File.class), anyMap())).then(invocationOnMock -> null); | ||||
| 
 | ||||
|             configDriveBuilderMocked.when(() -> ConfigDriveBuilder.linkUserData((Mockito.anyString()))).then(invocationOnMock -> null); | ||||
| 
 | ||||
| @ -145,7 +145,7 @@ public class ConfigDriveBuilderTest { | ||||
| 
 | ||||
|             configDriveBuilderMocked.verify(() -> { | ||||
|                 ConfigDriveBuilder.writeVendorAndNetworkEmptyJsonFile(Mockito.any(File.class)); | ||||
|                 ConfigDriveBuilder.writeVmMetadata(Mockito.anyListOf(String[].class), Mockito.anyString(), Mockito.any(File.class), anyMap()); | ||||
|                 ConfigDriveBuilder.writeVmMetadata(Mockito.anyList(), Mockito.anyString(), Mockito.any(File.class), anyMap()); | ||||
|                 ConfigDriveBuilder.linkUserData(Mockito.anyString()); | ||||
|                 ConfigDriveBuilder.generateAndRetrieveIsoAsBase64Iso(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); | ||||
|             }); | ||||
| @ -194,7 +194,7 @@ public class ConfigDriveBuilderTest { | ||||
|     @Test | ||||
|     public void writeVmMetadataTest() { | ||||
|         try (MockedStatic<ConfigDriveBuilder> configDriveBuilderMocked = Mockito.mockStatic(ConfigDriveBuilder.class)) { | ||||
|             Mockito.when(ConfigDriveBuilder.createJsonObjectWithVmData(Mockito.anyListOf(String[].class), Mockito.anyString(), Mockito.anyMap())).thenReturn(new JsonObject()); | ||||
|             Mockito.when(ConfigDriveBuilder.createJsonObjectWithVmData(Mockito.anyList(), Mockito.anyString(), Mockito.anyMap())).thenReturn(new JsonObject()); | ||||
| 
 | ||||
|             List<String[]> vmData = new ArrayList<>(); | ||||
|             vmData.add(new String[]{"dataType", "fileName", "content"}); | ||||
| @ -347,7 +347,7 @@ public class ConfigDriveBuilderTest { | ||||
| 
 | ||||
|         try (MockedStatic<ConfigDriveBuilder> configDriveBuilderMocked = Mockito.mockStatic(ConfigDriveBuilder.class)) { | ||||
| 
 | ||||
|             Mockito.when(ConfigDriveBuilder.createJsonObjectWithVmData(Mockito.anyListOf(String[].class), Mockito.anyString(), Mockito.nullable(Map.class))).thenCallRealMethod(); | ||||
|             Mockito.when(ConfigDriveBuilder.createJsonObjectWithVmData(Mockito.anyList(), Mockito.anyString(), Mockito.nullable(Map.class))).thenCallRealMethod(); | ||||
| 
 | ||||
|             List<String[]> vmData = new ArrayList<>(); | ||||
|             vmData.add(new String[]{"dataType", "fileName", "content"}); | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -51,7 +51,7 @@ import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.agent.AgentManager; | ||||
| import com.cloud.agent.api.Answer; | ||||
|  | ||||
| @ -47,7 +47,7 @@ import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.mockito.verification.VerificationMode; | ||||
| 
 | ||||
| import com.cloud.agent.api.MigrateCommand; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -33,7 +33,7 @@ import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.storage.Snapshot; | ||||
| import com.cloud.storage.Storage.ImageFormat; | ||||
|  | ||||
| @ -47,7 +47,7 @@ import org.apache.cloudstack.test.utils.SpringUtils; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.ComponentScan; | ||||
| @ -192,22 +192,22 @@ public class VMSnapshotStrategyKVMTest extends TestCase{ | ||||
|         UserVmVO userVmVO = Mockito.mock(UserVmVO.class); | ||||
|         Mockito.when(userVmVO.getGuestOSId()).thenReturn(guestOsId); | ||||
|         Mockito.when(vmSnapshot.getVmId()).thenReturn(vmId); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(Matchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(Matchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(ArgumentMatchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(ArgumentMatchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(ArgumentMatchers.anyLong())).thenReturn(userVmVO); | ||||
|         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class); | ||||
|         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO); | ||||
|         Mockito.when(guestOSDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSVO); | ||||
|         GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class); | ||||
|         Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(ArgumentMatchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(ArgumentMatchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshot.getId()).thenReturn(1L); | ||||
|         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date()); | ||||
|         HostVO hostVO = Mockito.mock(HostVO.class); | ||||
|         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostDao.findById(ArgumentMatchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType); | ||||
|         Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion); | ||||
| 
 | ||||
| @ -270,22 +270,22 @@ public class VMSnapshotStrategyKVMTest extends TestCase{ | ||||
|         UserVmVO userVmVO = Mockito.mock(UserVmVO.class); | ||||
|         Mockito.when(userVmVO.getGuestOSId()).thenReturn(guestOsId); | ||||
|         Mockito.when(vmSnapshot.getVmId()).thenReturn(vmId); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(Matchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(Matchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(ArgumentMatchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(ArgumentMatchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(ArgumentMatchers.anyLong())).thenReturn(userVmVO); | ||||
|         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class); | ||||
|         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO); | ||||
|         Mockito.when(guestOSDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSVO); | ||||
|         GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class); | ||||
|         Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(ArgumentMatchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(ArgumentMatchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshot.getId()).thenReturn(1L); | ||||
|         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date()); | ||||
|         HostVO hostVO = Mockito.mock(HostVO.class); | ||||
|         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostDao.findById(ArgumentMatchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType); | ||||
|         Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion); | ||||
|         DeleteVMSnapshotAnswer answer = Mockito.mock(DeleteVMSnapshotAnswer.class); | ||||
|  | ||||
| @ -33,7 +33,7 @@ import org.apache.cloudstack.test.utils.SpringUtils; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.ComponentScan; | ||||
| @ -115,18 +115,18 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
|         UserVmVO userVmVO = Mockito.mock(UserVmVO.class); | ||||
|         Mockito.when(userVmVO.getGuestOSId()).thenReturn(guestOsId); | ||||
|         Mockito.when(vmSnapshot.getVmId()).thenReturn(vmId); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(Matchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(Matchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(ArgumentMatchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(ArgumentMatchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(ArgumentMatchers.anyLong())).thenReturn(userVmVO); | ||||
|         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class); | ||||
|         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO); | ||||
|         Mockito.when(guestOSDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSVO); | ||||
|         GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class); | ||||
|         Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(null); | ||||
|         HostVO hostVO = Mockito.mock(HostVO.class); | ||||
|         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostDao.findById(ArgumentMatchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType); | ||||
|         Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion); | ||||
|         Exception e = null; | ||||
| @ -139,8 +139,8 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
|         assertNotNull(e); | ||||
|         CreateVMSnapshotAnswer answer = Mockito.mock(CreateVMSnapshotAnswer.class); | ||||
|         Mockito.when(answer.getResult()).thenReturn(true); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(answer); | ||||
|         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(answer); | ||||
|         Mockito.when(vmSnapshotDao.findById(ArgumentMatchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         VMSnapshot snapshot = null; | ||||
|         snapshot = vmSnapshotStrategy.takeVMSnapshot(vmSnapshot); | ||||
|         assertNotNull(snapshot); | ||||
| @ -159,23 +159,23 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
|         UserVmVO userVmVO = Mockito.mock(UserVmVO.class); | ||||
|         Mockito.when(userVmVO.getGuestOSId()).thenReturn(guestOsId); | ||||
|         Mockito.when(vmSnapshot.getVmId()).thenReturn(vmId); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(Matchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(Matchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(ArgumentMatchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(ArgumentMatchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(ArgumentMatchers.anyLong())).thenReturn(userVmVO); | ||||
|         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class); | ||||
|         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO); | ||||
|         Mockito.when(guestOSDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSVO); | ||||
|         GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class); | ||||
|         Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(ArgumentMatchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(ArgumentMatchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshot.getId()).thenReturn(1L); | ||||
|         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date()); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(null); | ||||
|         HostVO hostVO = Mockito.mock(HostVO.class); | ||||
|         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostDao.findById(ArgumentMatchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType); | ||||
|         Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion); | ||||
|         Exception e = null; | ||||
| @ -189,7 +189,7 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
| 
 | ||||
|         RevertToVMSnapshotAnswer answer = Mockito.mock(RevertToVMSnapshotAnswer.class); | ||||
|         Mockito.when(answer.getResult()).thenReturn(Boolean.TRUE); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(answer); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(answer); | ||||
|         boolean result = vmSnapshotStrategy.revertVMSnapshot(vmSnapshot); | ||||
|         assertTrue(result); | ||||
|     } | ||||
| @ -207,23 +207,23 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
|         UserVmVO userVmVO = Mockito.mock(UserVmVO.class); | ||||
|         Mockito.when(userVmVO.getGuestOSId()).thenReturn(guestOsId); | ||||
|         Mockito.when(vmSnapshot.getVmId()).thenReturn(vmId); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(Matchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(Matchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(Matchers.anyLong())).thenReturn(userVmVO); | ||||
|         Mockito.when(vmSnapshotHelper.pickRunningHost(ArgumentMatchers.anyLong())).thenReturn(hostId); | ||||
|         Mockito.when(vmSnapshotHelper.getVolumeTOList(ArgumentMatchers.anyLong())).thenReturn(volumeObjectTOs); | ||||
|         Mockito.when(userVmDao.findById(ArgumentMatchers.anyLong())).thenReturn(userVmVO); | ||||
|         GuestOSVO guestOSVO = Mockito.mock(GuestOSVO.class); | ||||
|         Mockito.when(guestOSDao.findById(Matchers.anyLong())).thenReturn(guestOSVO); | ||||
|         Mockito.when(guestOSDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSVO); | ||||
|         GuestOSHypervisorVO guestOSHypervisorVO = Mockito.mock(GuestOSHypervisorVO.class); | ||||
|         Mockito.when(guestOSHypervisorVO.getGuestOsName()).thenReturn(guestOsName); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(Matchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findById(ArgumentMatchers.anyLong())).thenReturn(guestOSHypervisorVO); | ||||
|         Mockito.when(guestOsHypervisorDao.findByOsIdAndHypervisor(ArgumentMatchers.anyLong(), ArgumentMatchers.anyString(), ArgumentMatchers.anyString())).thenReturn(guestOSHypervisorVO); | ||||
|         VMSnapshotTO vmSnapshotTO = Mockito.mock(VMSnapshotTO.class); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(Matchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(Matchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshotHelper.getSnapshotWithParents(ArgumentMatchers.any(VMSnapshotVO.class))).thenReturn(vmSnapshotTO); | ||||
|         Mockito.when(vmSnapshotDao.findById(ArgumentMatchers.anyLong())).thenReturn(vmSnapshot); | ||||
|         Mockito.when(vmSnapshot.getId()).thenReturn(1L); | ||||
|         Mockito.when(vmSnapshot.getCreated()).thenReturn(new Date()); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(null); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(null); | ||||
|         HostVO hostVO = Mockito.mock(HostVO.class); | ||||
|         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostDao.findById(ArgumentMatchers.anyLong())).thenReturn(hostVO); | ||||
|         Mockito.when(hostVO.getHypervisorType()).thenReturn(hypervisorType); | ||||
|         Mockito.when(hostVO.getHypervisorVersion()).thenReturn(hypervisorVersion); | ||||
| 
 | ||||
| @ -238,7 +238,7 @@ public class VMSnapshotStrategyTest extends TestCase { | ||||
| 
 | ||||
|         DeleteVMSnapshotAnswer answer = Mockito.mock(DeleteVMSnapshotAnswer.class); | ||||
|         Mockito.when(answer.getResult()).thenReturn(true); | ||||
|         Mockito.when(agentMgr.send(Matchers.anyLong(), Matchers.any(Command.class))).thenReturn(answer); | ||||
|         Mockito.when(agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Command.class))).thenReturn(answer); | ||||
| 
 | ||||
|         boolean result = vmSnapshotStrategy.deleteVMSnapshot(vmSnapshot); | ||||
|         assertTrue(result); | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -17,7 +17,7 @@ | ||||
| package org.apache.cloudstack.engine.subsystem.api.storage; | ||||
| 
 | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.mock; | ||||
| 
 | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.cluster.dao.ManagementServerHostDao; | ||||
| import com.cloud.utils.component.ComponentLifecycle; | ||||
|  | ||||
| @ -17,7 +17,7 @@ | ||||
| package org.apache.cloudstack.framework.config.impl; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
| import static org.mockito.Mockito.when; | ||||
| @ -28,6 +28,7 @@ import junit.framework.TestCase; | ||||
| 
 | ||||
| import org.apache.cloudstack.framework.config.dao.ConfigurationGroupDao; | ||||
| import org.apache.cloudstack.framework.config.dao.ConfigurationSubGroupDao; | ||||
| import org.junit.After; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| @ -74,13 +75,15 @@ public class ConfigDepotAdminTest extends TestCase { | ||||
|     @Mock | ||||
|     ScopedConfigStorage _scopedStorage; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     /** | ||||
|      * @throws java.lang.Exception | ||||
|      */ | ||||
|     @Override | ||||
|     @Before | ||||
|     public void setUp() throws Exception { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         _depotAdmin = new ConfigDepotImpl(); | ||||
|         _depotAdmin._configDao = _configDao; | ||||
|         _depotAdmin._configGroupDao = _configGroupDao; | ||||
| @ -91,6 +94,12 @@ public class ConfigDepotAdminTest extends TestCase { | ||||
|         _depotAdmin._scopedStorages.add(_scopedStorage); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testAutoPopulation() { | ||||
|         ConfigurationVO dynamicIntCV = new ConfigurationVO("UnitTestComponent", DynamicIntCK); | ||||
|  | ||||
| @ -36,10 +36,10 @@ import org.junit.Before; | ||||
| import org.junit.Ignore; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.utils.db.DbUtil; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| @ -150,13 +150,13 @@ public class DbUtilTest { | ||||
|     @Test | ||||
|     public void getGlobalLock() throws SQLException { | ||||
|         Mockito.when(dataSource.getConnection()).thenReturn(connection); | ||||
|         Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(connection.prepareStatement(ArgumentMatchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet); | ||||
|         Mockito.when(resultSet.first()).thenReturn(true); | ||||
|         Mockito.when(resultSet.getInt(1)).thenReturn(1); | ||||
|         Assert.assertTrue(DbUtil.getGlobalLock("TEST", 600)); | ||||
| 
 | ||||
|         Mockito.verify(connection).prepareStatement(Matchers.anyString()); | ||||
|         Mockito.verify(connection).prepareStatement(ArgumentMatchers.anyString()); | ||||
|         Mockito.verify(preparedStatement).close(); | ||||
|         Mockito.verify(resultSet).close(); | ||||
|     } | ||||
| @ -164,13 +164,13 @@ public class DbUtilTest { | ||||
|     @Test | ||||
|     public void getGlobalLockTimeout() throws SQLException { | ||||
|         Mockito.when(dataSource.getConnection()).thenReturn(connection); | ||||
|         Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(connection.prepareStatement(ArgumentMatchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet); | ||||
|         Mockito.when(resultSet.first()).thenReturn(true); | ||||
|         Mockito.when(resultSet.getInt(1)).thenReturn(0); | ||||
|         Assert.assertFalse(DbUtil.getGlobalLock("TEST", 600)); | ||||
| 
 | ||||
|         Mockito.verify(connection).prepareStatement(Matchers.anyString()); | ||||
|         Mockito.verify(connection).prepareStatement(ArgumentMatchers.anyString()); | ||||
|         Mockito.verify(preparedStatement).close(); | ||||
|         Mockito.verify(resultSet).close(); | ||||
|         Mockito.verify(connection).close(); | ||||
| @ -237,7 +237,7 @@ public class DbUtilTest { | ||||
| 
 | ||||
|     @Test | ||||
|     public void releaseGlobalLock() throws SQLException { | ||||
|         Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(connection.prepareStatement(ArgumentMatchers.anyString())).thenReturn(preparedStatement); | ||||
|         Mockito.when(preparedStatement.executeQuery()).thenReturn(resultSet); | ||||
|         Mockito.when(resultSet.first()).thenReturn(true); | ||||
|         Mockito.when(resultSet.getInt(1)).thenReturn(1); | ||||
|  | ||||
| @ -40,7 +40,7 @@ import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.domain.DomainVO; | ||||
| import com.cloud.domain.dao.DomainDao; | ||||
| @ -177,7 +177,7 @@ public class QuotaAlertManagerImplTest extends TestCase { | ||||
|         quotaAlertManager.sendQuotaAlert(email); | ||||
|         assertTrue(email.getSendDate() != null); | ||||
| 
 | ||||
|         Mockito.verify(quotaAlertManager, Mockito.times(1)).sendQuotaAlert(Mockito.any(), Mockito.anyListOf(String.class), Mockito.anyString(), Mockito.anyString()); | ||||
|         Mockito.verify(quotaAlertManager, Mockito.times(1)).sendQuotaAlert(Mockito.any(), Mockito.anyList(), Mockito.anyString(), Mockito.anyString()); | ||||
|         Mockito.verify(quotaAlertManager.mailSender, Mockito.times(1)).sendMail(Mockito.any(SMTPMailProperties.class)); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -38,7 +38,7 @@ import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.user.AccountVO; | ||||
| import com.cloud.user.dao.AccountDao; | ||||
|  | ||||
| @ -22,7 +22,7 @@ import org.apache.cloudstack.api.response.UsageTypeResponse; | ||||
| import org.apache.cloudstack.usage.UsageTypes; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -25,6 +25,7 @@ import com.cloud.vm.VirtualMachineProfile; | ||||
| import com.cloud.vm.dao.VMInstanceDao; | ||||
| import org.apache.cloudstack.affinity.dao.AffinityGroupDao; | ||||
| import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; | ||||
| import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| @ -43,8 +44,8 @@ import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.verify; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
| @ -99,9 +100,11 @@ public class HostAffinityProcessorTest { | ||||
|     @Mock | ||||
|     VirtualMachineProfile profile; | ||||
| 
 | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setup() { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
| 
 | ||||
|         when(groupVM1.getHostId()).thenReturn(HOST_ID); | ||||
|         when(groupVM2.getHostId()).thenReturn(HOST_ID); | ||||
| @ -124,6 +127,11 @@ public class HostAffinityProcessorTest { | ||||
|         when(affinityGroupVMMapDao.findByVmIdType(eq(VM_ID), any())).thenReturn(new ArrayList<>(Arrays.asList(mapVO))); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testProcessAffinityGroupMultipleVMs() { | ||||
|         processor.processAffinityGroup(mapVO, plan, vm); | ||||
|  | ||||
| @ -34,7 +34,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.certificate.CrlVO; | ||||
| import com.cloud.certificate.dao.CrlDao; | ||||
|  | ||||
| @ -28,7 +28,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import junit.framework.TestCase; | ||||
| 
 | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| @ -25,7 +25,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| 
 | ||||
|  | ||||
| @ -24,7 +24,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| @ -25,7 +25,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.math.BigDecimal; | ||||
|  | ||||
| @ -27,7 +27,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import java.lang.reflect.Field; | ||||
| import java.math.BigDecimal; | ||||
|  | ||||
| @ -36,7 +36,7 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import javax.naming.ConfigurationException; | ||||
| import java.lang.reflect.Field; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -18,7 +18,7 @@ package org.apache.cloudstack.dedicated.manager; | ||||
| 
 | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.nullable; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
|  | ||||
| @ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue; | ||||
| import static org.hamcrest.MatcherAssert.assertThat; | ||||
| import static org.hamcrest.Matchers.everyItem; | ||||
| import static org.hamcrest.Matchers.equalTo; | ||||
| import static org.mockito.Matchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -24,7 +24,7 @@ import org.junit.Assert; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.MockedStatic; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| @ -51,7 +51,7 @@ public class DpdkDriverTest { | ||||
|     public void initMocks() { | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         scriptMockedStatic = Mockito.mockStatic(Script.class); | ||||
|         Mockito.when(Script.runSimpleBashScript(Matchers.anyString())).thenReturn(null); | ||||
|         Mockito.when(Script.runSimpleBashScript(ArgumentMatchers.anyString())).thenReturn(null); | ||||
|         extraConfig = new HashMap<>(); | ||||
|     } | ||||
| 
 | ||||
| @ -68,14 +68,14 @@ public class DpdkDriverTest { | ||||
| 
 | ||||
|     @Test | ||||
|     public void testGetDpdkLatestPortNumberUsedExistingDpdkPorts() { | ||||
|         Mockito.when(Script.runSimpleBashScript(Matchers.anyString())). | ||||
|         Mockito.when(Script.runSimpleBashScript(ArgumentMatchers.anyString())). | ||||
|                 thenReturn(DpdkDriverImpl.DPDK_PORT_PREFIX + String.valueOf(dpdkPortNumber)); | ||||
|         Assert.assertEquals(dpdkPortNumber, driver.getDpdkLatestPortNumberUsed()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void testGetNextDpdkPortNoDpdkPorts() { | ||||
|         Mockito.when(Script.runSimpleBashScript(Matchers.anyString())). | ||||
|         Mockito.when(Script.runSimpleBashScript(ArgumentMatchers.anyString())). | ||||
|                 thenReturn(null); | ||||
|         String expectedPortName = DpdkDriverImpl.DPDK_PORT_PREFIX + String.valueOf(1); | ||||
|         Assert.assertEquals(expectedPortName, driver.getNextDpdkPort()); | ||||
| @ -83,7 +83,7 @@ public class DpdkDriverTest { | ||||
| 
 | ||||
|     @Test | ||||
|     public void testGetNextDpdkPortExistingDpdkPorts() { | ||||
|         Mockito.when(Script.runSimpleBashScript(Matchers.anyString())). | ||||
|         Mockito.when(Script.runSimpleBashScript(ArgumentMatchers.anyString())). | ||||
|                 thenReturn(DpdkDriverImpl.DPDK_PORT_PREFIX + String.valueOf(dpdkPortNumber)); | ||||
|         String expectedPortName = DpdkDriverImpl.DPDK_PORT_PREFIX + String.valueOf(dpdkPortNumber + 1); | ||||
|         Assert.assertEquals(expectedPortName, driver.getNextDpdkPort()); | ||||
|  | ||||
| @ -39,11 +39,11 @@ import org.libvirt.DomainInfo; | ||||
| import org.libvirt.LibvirtException; | ||||
| import org.libvirt.TypedParameter; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| import org.xml.sax.SAXException; | ||||
| 
 | ||||
| import javax.xml.parsers.ParserConfigurationException; | ||||
| @ -297,7 +297,7 @@ public class LibvirtMigrateVolumeCommandWrapperTest { | ||||
| 
 | ||||
|         Mockito.doReturn(domxml).when(dm).getXMLDesc(0); | ||||
| 
 | ||||
|         Mockito.doNothing().when(dm).blockCopy(Matchers.anyString(), Matchers.anyString(), Matchers.any(TypedParameter[].class), Matchers.anyInt()); | ||||
|         Mockito.doNothing().when(dm).blockCopy(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(TypedParameter[].class), ArgumentMatchers.anyInt()); | ||||
|         MigrateVolumeAnswer answer = new MigrateVolumeAnswer(command, true, null, destPath); | ||||
|         Mockito.doReturn(answer).when(libvirtMigrateVolumeCommandWrapper).checkBlockJobStatus(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); | ||||
| 
 | ||||
| @ -342,7 +342,7 @@ public class LibvirtMigrateVolumeCommandWrapperTest { | ||||
| 
 | ||||
|         Mockito.doReturn(null).when(destVolumeObjectTO).getPassphrase(); | ||||
|         Mockito.doReturn(domxml).when(dm).getXMLDesc(0); | ||||
|         Mockito.doThrow(LibvirtException.class).when(dm).blockCopy(Matchers.anyString(), Matchers.anyString(), Matchers.any(TypedParameter[].class), Matchers.anyInt()); | ||||
|         Mockito.doThrow(LibvirtException.class).when(dm).blockCopy(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(TypedParameter[].class), ArgumentMatchers.anyInt()); | ||||
| 
 | ||||
|         Answer migrateVolumeAnswer = libvirtMigrateVolumeCommandWrapper.migratePowerFlexVolume(command, libvirtComputingResource); | ||||
| 
 | ||||
|  | ||||
| @ -29,7 +29,7 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.exception.StorageUnavailableException; | ||||
| import com.cloud.host.Host; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -28,7 +28,7 @@ import org.junit.runner.RunWith; | ||||
| import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.agent.api.Command; | ||||
| import com.cloud.agent.api.to.DataObjectType; | ||||
|  | ||||
| @ -25,7 +25,7 @@ import org.mockito.InjectMocks; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.storage.Storage.TemplateType; | ||||
| import com.cloud.storage.VMTemplateVO; | ||||
|  | ||||
| @ -24,7 +24,7 @@ import org.junit.runner.RunWith; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.Spy; | ||||
| import org.mockito.runners.MockitoJUnitRunner; | ||||
| import org.mockito.junit.MockitoJUnitRunner; | ||||
| 
 | ||||
| import com.cloud.agent.api.MigrateCommand; | ||||
| import com.cloud.agent.api.to.VirtualMachineTO; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -128,7 +128,7 @@ public class MetricsServiceImplTest { | ||||
| 
 | ||||
|         Mockito.verify(scMock).setParameters(stringCaptor1.capture(), objectArrayCaptor.capture()); | ||||
|         Assert.assertEquals("idIN", stringCaptor1.getValue()); | ||||
|         Assert.assertEquals(Arrays.asList(fakeVmId1), objectArrayCaptor.getAllValues()); | ||||
|         Assert.assertEquals(fakeVmId1, objectArrayCaptor.getAllValues().get(0)[0]); | ||||
|         Assert.assertEquals(expectedVmListAndCounter, result); | ||||
|     } | ||||
| 
 | ||||
| @ -146,7 +146,7 @@ public class MetricsServiceImplTest { | ||||
| 
 | ||||
|         Mockito.verify(scMock).setParameters(stringCaptor1.capture(), objectArrayCaptor.capture()); | ||||
|         Assert.assertEquals("idIN", stringCaptor1.getValue()); | ||||
|         Assert.assertEquals(expected, objectArrayCaptor.getAllValues()); | ||||
|         Assert.assertArrayEquals(expected.toArray(), objectArrayCaptor.getAllValues().get(0)); | ||||
|         Assert.assertEquals(expectedVmListAndCounter, result); | ||||
|     } | ||||
| 
 | ||||
| @ -163,7 +163,7 @@ public class MetricsServiceImplTest { | ||||
| 
 | ||||
|         Mockito.verify(scMock).setParameters(stringCaptor1.capture(), objectArrayCaptor.capture()); | ||||
|         Assert.assertEquals("displayName", stringCaptor1.getValue()); | ||||
|         Assert.assertEquals("%fakeName%", objectArrayCaptor.getValue()); | ||||
|         Assert.assertEquals("%fakeName%", objectArrayCaptor.getValue()[0]); | ||||
|         Assert.assertEquals(expectedVmListAndCounter, result); | ||||
|     } | ||||
| 
 | ||||
| @ -184,8 +184,8 @@ public class MetricsServiceImplTest { | ||||
|         List<Object[]> params = objectArrayCaptor.getAllValues(); | ||||
|         Assert.assertEquals("displayName", conditions.get(0)); | ||||
|         Assert.assertEquals("state", conditions.get(1)); | ||||
|         Assert.assertEquals("%fakeKeyword%", params.get(0)); | ||||
|         Assert.assertEquals("fakeKeyword", params.get(1)); | ||||
|         Assert.assertEquals("%fakeKeyword%", params.get(0)[0]); | ||||
|         Assert.assertEquals("fakeKeyword", params.get(1)[0]); | ||||
|         Assert.assertEquals(expectedVmListAndCounter, result); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -21,7 +21,7 @@ package com.cloud.network.bigswitch; | ||||
| 
 | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotEquals; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
|  | ||||
| @ -21,6 +21,7 @@ package com.cloud.network.bigswitch; | ||||
| 
 | ||||
| import static org.junit.Assert.assertEquals; | ||||
| 
 | ||||
| import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.mockito.Mock; | ||||
| @ -73,16 +74,22 @@ public class BigSwitchBcfUtilsTest { | ||||
|     NetworkModel networkModel; | ||||
|     @Mock | ||||
|     BigSwitchBcfUtils bsUtil; | ||||
|     private AutoCloseable closeable; | ||||
| 
 | ||||
|     @Before | ||||
|     public void setUp() { | ||||
|         MockitoAnnotations.initMocks(this); | ||||
|         closeable = MockitoAnnotations.openMocks(this); | ||||
|         bsUtil = new BigSwitchBcfUtils(networkDao, nicDao, vmDao, hostDao, | ||||
|                 vpcDao, bigswitchBcfDao, agentMgr, vlanDao, ipAddressDao, | ||||
|                 fwRulesDao, fwCidrsDao, aclItemDao, aclItemCidrsDao, | ||||
|                 networkModel); | ||||
|     } | ||||
| 
 | ||||
|     @After | ||||
|     public void tearDown() throws Exception { | ||||
|         closeable.close(); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void getSubnetMaskLengthTest() { | ||||
|         Integer rc = bsUtil.getSubnetMaskLength("255.255.255.254"); | ||||
|  | ||||
| @ -21,7 +21,7 @@ package com.cloud.network.resource; | ||||
| 
 | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.Mockito.doThrow; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.times; | ||||
|  | ||||
| @ -21,10 +21,10 @@ package com.cloud.network.guru; | ||||
| 
 | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.anyInt; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.anyInt; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
|  | ||||
| @ -18,8 +18,8 @@ package com.cloud.network.element; | ||||
| 
 | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static  org.mockito.ArgumentMatchers.any; | ||||
| import static  org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -17,9 +17,9 @@ | ||||
| package com.cloud.network.resource; | ||||
| 
 | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.anyBoolean; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.anyBoolean; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -16,8 +16,8 @@ | ||||
| */ | ||||
| package com.globo.globodns.cloudstack.element; | ||||
| 
 | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.Matchers.isA; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static  org.mockito.ArgumentMatchers.isA; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
|  | ||||
| @ -18,7 +18,7 @@ package com.globo.globodns.cloudstack.resource; | ||||
| 
 | ||||
| import static org.junit.Assert.assertEquals; | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| import static org.mockito.Mockito.spy; | ||||
|  | ||||
| @ -26,7 +26,7 @@ import javax.inject.Inject; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| @ -86,7 +86,7 @@ public class InternalLbElementServiceTest { | ||||
|         Mockito.when(_pNtwkProviderDao.findById(validProviderId)).thenReturn(validProvider); | ||||
|         Mockito.when(_pNtwkProviderDao.findById(invalidProviderId)).thenReturn(invalidProvider); | ||||
| 
 | ||||
|         Mockito.when(_vrProviderDao.persist(Matchers.any(VirtualRouterProviderVO.class))).thenReturn(validElement); | ||||
|         Mockito.when(_vrProviderDao.persist(ArgumentMatchers.any(VirtualRouterProviderVO.class))).thenReturn(validElement); | ||||
|     } | ||||
| 
 | ||||
|     //TESTS FOR getInternalLoadBalancerElement METHOD | ||||
|  | ||||
| @ -31,7 +31,7 @@ import javax.inject.Inject; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| @ -116,10 +116,10 @@ public class InternalLbElementTest { | ||||
|         Mockito.when(_pNtwkProviderDao.findById(validProviderId)).thenReturn(validProvider); | ||||
|         Mockito.when(_pNtwkProviderDao.findById(invalidProviderId)).thenReturn(invalidProvider); | ||||
| 
 | ||||
|         Mockito.when(_vrProviderDao.persist(Matchers.any(VirtualRouterProviderVO.class))).thenReturn(validElement); | ||||
|         Mockito.when(_vrProviderDao.persist(ArgumentMatchers.any(VirtualRouterProviderVO.class))).thenReturn(validElement); | ||||
| 
 | ||||
|         DataCenterVO dc = new DataCenterVO(1L, null, null, null, null, null, null, null, null, null, NetworkType.Advanced, null, null); | ||||
|         Mockito.when(_entityMgr.findById(Matchers.eq(DataCenter.class), Matchers.anyLong())).thenReturn(dc); | ||||
|         Mockito.when(_entityMgr.findById(ArgumentMatchers.eq(DataCenter.class), ArgumentMatchers.anyLong())).thenReturn(dc); | ||||
|     } | ||||
| 
 | ||||
|     //TEST FOR getProvider() method | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| @ -164,15 +164,15 @@ public class InternalLBVMManagerTest extends TestCase { | ||||
|         } | ||||
| 
 | ||||
|         createNetwork(); | ||||
|         Mockito.when(_ntwkModel.getNetwork(Matchers.anyLong())).thenReturn(ntwk); | ||||
|         Mockito.when(_ntwkModel.getNetwork(ArgumentMatchers.anyLong())).thenReturn(ntwk); | ||||
| 
 | ||||
|         Mockito.when(_itMgr.toNicTO(Matchers.any(NicProfile.class), Matchers.any(HypervisorType.class))).thenReturn(null); | ||||
|         Mockito.when(_domainRouterDao.findById(Matchers.anyLong())).thenReturn(vm); | ||||
|         Mockito.when(_itMgr.toNicTO(ArgumentMatchers.any(NicProfile.class), ArgumentMatchers.any(HypervisorType.class))).thenReturn(null); | ||||
|         Mockito.when(_domainRouterDao.findById(ArgumentMatchers.anyLong())).thenReturn(vm); | ||||
|         final DataCenterVO dc = new DataCenterVO(1L, null, null, null, null, null, null, null, null, null, NetworkType.Advanced, null, null); | ||||
|         Mockito.when(_dcDao.findById(Matchers.anyLong())).thenReturn(dc); | ||||
|         Mockito.when(_dcDao.findById(ArgumentMatchers.anyLong())).thenReturn(dc); | ||||
|         final NetworkOfferingVO networkOfferingVO = new NetworkOfferingVO(); | ||||
|         networkOfferingVO.setConcurrentConnections(500); | ||||
|         Mockito.when(_offeringDao.findById(Matchers.anyLong())).thenReturn(networkOfferingVO); | ||||
|         Mockito.when(_offeringDao.findById(ArgumentMatchers.anyLong())).thenReturn(networkOfferingVO); | ||||
| 
 | ||||
|         Mockito.when(_domainRouterDao.findById(validVmId)).thenReturn(vm); | ||||
|         Mockito.when(_domainRouterDao.findById(invalidVmId)).thenReturn(null); | ||||
|  | ||||
| @ -30,7 +30,7 @@ import org.junit.After; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| @ -105,7 +105,7 @@ public class InternalLBVMServiceTest extends TestCase { | ||||
| 
 | ||||
|         Mockito.when(_accountMgr.getSystemUser()).thenReturn(new UserVO(1)); | ||||
|         Mockito.when(_accountMgr.getSystemAccount()).thenReturn(new AccountVO(2)); | ||||
|         Mockito.when(_accountDao.findByIdIncludingRemoved(Matchers.anyLong())).thenReturn(new AccountVO(2)); | ||||
|         Mockito.when(_accountDao.findByIdIncludingRemoved(ArgumentMatchers.anyLong())).thenReturn(new AccountVO(2)); | ||||
|         CallContext.register(_accountMgr.getSystemUser(), _accountMgr.getSystemAccount()); | ||||
| 
 | ||||
|         final DomainRouterVO validVm = | ||||
|  | ||||
| @ -24,7 +24,7 @@ import javax.inject.Inject; | ||||
| import org.apache.cloudstack.framework.config.dao.ConfigurationGroupDaoImpl; | ||||
| import org.apache.cloudstack.framework.config.dao.ConfigurationSubGroupDaoImpl; | ||||
| import org.eclipse.jetty.security.IdentityService; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.invocation.InvocationOnMock; | ||||
| import org.mockito.stubbing.Answer; | ||||
| @ -390,8 +390,8 @@ public class IntegrationTestConfiguration { | ||||
|                 } | ||||
|             }); | ||||
|             Mockito.when( | ||||
|                 mock.createAffinityGroup(Matchers.any(String.class), Matchers.any(Long.class), Matchers.any(Long.class), Matchers.any(String.class), Matchers.any(String.class), | ||||
|                     Matchers.any(String.class))).thenReturn(gmock); | ||||
|                 mock.createAffinityGroup(ArgumentMatchers.any(String.class), ArgumentMatchers.any(Long.class), ArgumentMatchers.any(Long.class), ArgumentMatchers.any(String.class), ArgumentMatchers.any(String.class), | ||||
|                     ArgumentMatchers.any(String.class))).thenReturn(gmock); | ||||
|         } catch (Exception e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
| @ -482,7 +482,7 @@ public class IntegrationTestConfiguration { | ||||
|     public DomainChecker domainChecker() { | ||||
|         DomainChecker mock = Mockito.mock(DomainChecker.class); | ||||
|         try { | ||||
|             Mockito.when(mock.checkAccess(Matchers.any(Account.class), Matchers.any(DataCenter.class))).thenReturn(true); | ||||
|             Mockito.when(mock.checkAccess(ArgumentMatchers.any(Account.class), ArgumentMatchers.any(DataCenter.class))).thenReturn(true); | ||||
|         } catch (Exception e) { | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
| @ -498,23 +498,23 @@ public class IntegrationTestConfiguration { | ||||
|     public EntityManager entityManager() { | ||||
|         EntityManager mock = Mockito.mock(EntityManager.class); | ||||
|         try { | ||||
|             Mockito.when(mock.findById(Matchers.same(Account.class), Matchers.anyLong())).thenReturn(_accountDao.findById(Account.ACCOUNT_ID_SYSTEM)); | ||||
|             Mockito.when(mock.findById(Matchers.same(User.class), Matchers.anyLong())).thenReturn(_userDao.findById(User.UID_SYSTEM)); | ||||
|             Mockito.when(mock.findById(Matchers.same(NetworkOffering.class), Matchers.any(Long.class))).thenAnswer(new Answer<NetworkOffering>() { | ||||
|             Mockito.when(mock.findById(ArgumentMatchers.same(Account.class), ArgumentMatchers.anyLong())).thenReturn(_accountDao.findById(Account.ACCOUNT_ID_SYSTEM)); | ||||
|             Mockito.when(mock.findById(ArgumentMatchers.same(User.class), ArgumentMatchers.anyLong())).thenReturn(_userDao.findById(User.UID_SYSTEM)); | ||||
|             Mockito.when(mock.findById(ArgumentMatchers.same(NetworkOffering.class), ArgumentMatchers.any(Long.class))).thenAnswer(new Answer<NetworkOffering>() { | ||||
|                 @Override | ||||
|                 public NetworkOffering answer(final InvocationOnMock invocation) throws Throwable { | ||||
|                     Long id = (Long)invocation.getArguments()[1]; | ||||
|                     return _networkOfferingDao.findById(id); | ||||
|                 } | ||||
|             }); | ||||
|             Mockito.when(mock.findById(Matchers.same(IpAddress.class), Matchers.any(Long.class))).thenAnswer(new Answer<IpAddress>() { | ||||
|             Mockito.when(mock.findById(ArgumentMatchers.same(IpAddress.class), ArgumentMatchers.any(Long.class))).thenAnswer(new Answer<IpAddress>() { | ||||
|                 @Override | ||||
|                 public IpAddress answer(final InvocationOnMock invocation) throws Throwable { | ||||
|                     Long id = (Long)invocation.getArguments()[1]; | ||||
|                     return _ipAddressDao.findById(id); | ||||
|                 } | ||||
|             }); | ||||
|             Mockito.when(mock.findById(Matchers.same(DataCenter.class), Matchers.any(Long.class))).thenAnswer(new Answer<DataCenter>() { | ||||
|             Mockito.when(mock.findById(ArgumentMatchers.same(DataCenter.class), ArgumentMatchers.any(Long.class))).thenAnswer(new Answer<DataCenter>() { | ||||
|                 @Override | ||||
|                 public DataCenter answer(final InvocationOnMock invocation) throws Throwable { | ||||
|                     Long id = (Long)invocation.getArguments()[1]; | ||||
|  | ||||
| @ -28,7 +28,7 @@ import java.util.UUID; | ||||
| import javax.inject.Inject; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| import org.mockito.Matchers; | ||||
| import org.mockito.ArgumentMatchers; | ||||
| import org.mockito.Mockito; | ||||
| import org.mockito.invocation.InvocationOnMock; | ||||
| import org.mockito.stubbing.Answer; | ||||
| @ -229,7 +229,7 @@ public class ManagementServerMock { | ||||
|             } | ||||
|         }; | ||||
|         try { | ||||
|             Mockito.when(_agentMgr.send(Matchers.anyLong(), Matchers.any(Commands.class))).thenAnswer(callback); | ||||
|             Mockito.when(_agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Commands.class))).thenAnswer(callback); | ||||
|         } catch (AgentUnavailableException e) { | ||||
|             // TODO Auto-generated catch block | ||||
|             e.printStackTrace(); | ||||
| @ -278,7 +278,7 @@ public class ManagementServerMock { | ||||
|         }; | ||||
| 
 | ||||
|         try { | ||||
|             Mockito.when(_agentMgr.send(Matchers.anyLong(), Matchers.any(Commands.class))).thenAnswer(callback); | ||||
|             Mockito.when(_agentMgr.send(ArgumentMatchers.anyLong(), ArgumentMatchers.any(Commands.class))).thenAnswer(callback); | ||||
|         } catch (AgentUnavailableException e) { | ||||
|             e.printStackTrace(); | ||||
|         } catch (OperationTimedoutException e) { | ||||
|  | ||||
| @ -17,9 +17,9 @@ | ||||
| 
 | ||||
| package org.apache.cloudstack.network.contrail.model; | ||||
| 
 | ||||
| import static org.mockito.Matchers.anyInt; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.anyInt; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -17,9 +17,9 @@ | ||||
| 
 | ||||
| package org.apache.cloudstack.network.contrail.model; | ||||
| 
 | ||||
| import static org.mockito.Matchers.anyInt; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.anyString; | ||||
| import static org.mockito.ArgumentMatchers.anyInt; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyString; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -17,7 +17,7 @@ | ||||
| 
 | ||||
| package org.apache.cloudstack.network.contrail.model; | ||||
| 
 | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.when; | ||||
| 
 | ||||
|  | ||||
| @ -21,9 +21,9 @@ package com.cloud.network.element; | ||||
| 
 | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.Matchers.argThat; | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.argThat; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.atLeast; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.verify; | ||||
|  | ||||
| @ -21,9 +21,9 @@ package com.cloud.network.guru; | ||||
| 
 | ||||
| import static org.junit.Assert.assertFalse; | ||||
| import static org.junit.Assert.assertTrue; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.Matchers.anyLong; | ||||
| import static org.mockito.Matchers.eq; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.ArgumentMatchers.anyLong; | ||||
| import static org.mockito.ArgumentMatchers.eq; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.times; | ||||
| import static org.mockito.Mockito.verify; | ||||
|  | ||||
| @ -23,7 +23,7 @@ import static org.hamcrest.MatcherAssert.assertThat; | ||||
| import static org.hamcrest.Matchers.equalTo; | ||||
| import static org.hamcrest.Matchers.hasProperty; | ||||
| import static org.hamcrest.Matchers.hasSize; | ||||
| import static org.mockito.Matchers.any; | ||||
| import static org.mockito.ArgumentMatchers.any; | ||||
| import static org.mockito.Mockito.doReturn; | ||||
| import static org.mockito.Mockito.mock; | ||||
| import static org.mockito.Mockito.spy; | ||||
|  | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
| @ -1 +0,0 @@ | ||||
| mock-maker-inline | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user