mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add unit tests for null cpu for null parameters for set allocated cpu (#9137)
* Add unit tests for null cpu for null parameters for set allocated cpu * break up tests for null cpu checks
This commit is contained in:
parent
faf94387a6
commit
c9a95bc22c
@ -56,4 +56,27 @@ public class HostMetricsResponseTest {
|
|||||||
Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetCpuAllocatedWithNullCpuNumber() {
|
||||||
|
String expected = null;
|
||||||
|
final HostMetricsResponse hostResponse = new HostMetricsResponse();
|
||||||
|
hostResponse.setCpuAllocated(String.format("50%s25%%", decimalSeparator), null, 1000L);
|
||||||
|
Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetCpuAllocatedWithNullCpuSpeed() {
|
||||||
|
String expected = null;
|
||||||
|
final HostMetricsResponse hostResponse = new HostMetricsResponse();
|
||||||
|
hostResponse.setCpuAllocated(String.format("50%s25%%", decimalSeparator), 10, null);
|
||||||
|
Assert.assertEquals(expected, hostResponse.getCpuAllocatedGhz());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user