DaanHoogland commented on a change in pull request #5633:
URL: https://github.com/apache/cloudstack/pull/5633#discussion_r737508016



##########
File path: server/src/test/java/com/cloud/server/StatsCollectorTest.java
##########
@@ -218,4 +239,48 @@ public void configureAndTestCheckIfDiskStatsAreZero(long 
bytesRead, long bytesWr
         boolean result = statsCollector.areAllDiskStatsZero(vmDiskStatsEntry);
         Assert.assertEquals(expected, result);
     }
+
+    @Test
+    public void removeVirtualMachineStatsTestRemoveOneVmStats() {
+        Mockito.doReturn(new 
Object()).when(vmStatsMock).remove(Mockito.anyLong());
+
+        statsCollector.removeVirtualMachineStats(1l);
+
+        Mockito.verify(vmStatsMock, 
Mockito.times(1)).remove(Mockito.anyLong());
+    }
+
+    @Test
+    public void cleanUpVirtualMachineStatsTestDoNothing() {
+        Mockito.doReturn(new 
ArrayList<>()).when(userVmDaoMock).listAllRunning();
+        Mockito.doReturn(new ConcurrentHashMap<Long, VmStats>(new 
HashMap<Long, VmStats>()).keySet())

Review comment:
       ```suggestion
           Mockito.doReturn(new ConcurrentHashMap<Long, VmStats>(new 
HashMap<>()).keySet())
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to