4343import org .apache .cloudstack .api .ApiConstants ;
4444import org .apache .cloudstack .framework .config .dao .ConfigurationDao ;
4545import org .junit .Assert ;
46- import org .junit .Before ;
4746import org .junit .Test ;
4847import org .junit .runner .RunWith ;
49- import org .mockito .ArgumentMatchers ;
5048import org .mockito .InjectMocks ;
5149import org .mockito .Mock ;
5250import org .mockito .Mockito ;
@@ -125,7 +123,7 @@ public class FirstFitAllocatorTest {
125123
126124 @ Test
127125 public void testConfigure () throws Exception {
128- when (configDao .getConfiguration (ArgumentMatchers .anyMap ())).thenReturn (new HashMap <>());
126+ when (configDao .getConfiguration (Mockito .anyMap ())).thenReturn (new HashMap <>());
129127 Assert .assertTrue (firstFitAllocatorSpy ._checkHvm );
130128 Assert .assertTrue (firstFitAllocatorSpy .configure ("test" , new HashMap <>()));
131129 }
@@ -139,12 +137,10 @@ public void testAllocateTo_SuccessfulMatch() {
139137 when (avoid .shouldAvoid (host2 )).thenReturn (false );
140138
141139 // CPU capability and capacity is met
142- when (capacityMgr .checkIfHostReachMaxGuestLimit (ArgumentMatchers .any ())).thenReturn (false );
143- when (capacityMgr .checkIfHostHasCpuCapabilityAndCapacity (ArgumentMatchers .eq (host1 ), ArgumentMatchers .eq (offering ),
144- ArgumentMatchers .eq (true )))
140+ when (capacityMgr .checkIfHostReachMaxGuestLimit (Mockito .any (Host .class ))).thenReturn (false );
141+ when (capacityMgr .checkIfHostHasCpuCapabilityAndCapacity (host1 , offering , true ))
145142 .thenReturn (new Pair <>(true , true ));
146- when (capacityMgr .checkIfHostHasCpuCapabilityAndCapacity (ArgumentMatchers .eq (host2 ), ArgumentMatchers .eq (offering ),
147- ArgumentMatchers .eq (true )))
143+ when (capacityMgr .checkIfHostHasCpuCapabilityAndCapacity (host2 , offering ,true ))
148144 .thenReturn (new Pair <>(true , false ));
149145
150146 when (resourceManagerMock .isGPUDeviceAvailable (offering , host1 , virtualMachineProfile .getId ())).thenReturn (true );
0 commit comments