JoaoJandre commented on code in PR #9137:
URL: https://github.com/apache/cloudstack/pull/9137#discussion_r1619376523
##########
plugins/metrics/src/test/java/org/apache/cloudstack/response/HostMetricsResponseTest.java:
##########
@@ -56,4 +56,15 @@ public void testSetCpuAllocatedWithValidCpu() {
Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
}
+ @Test
+ public void testSetCpuAllocatedWithNullCpu() {
+ String expected = null;
+ final HostMetricsResponse hostResponse = new HostMetricsResponse();
+ hostResponse.setCpuAllocated(null, 10, 1000L);
+ Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
+ hostResponse.setCpuAllocated(String.format("50%s25%%",
decimalSeparator), null, 1000L);
+ Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
+ hostResponse.setCpuAllocated(String.format("50%s25%%",
decimalSeparator), 10, null);
+ Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
+ }
Review Comment:
Each unit test should test only one test case. Please break this into
different tests.
--
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]