2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.dcaegen2.ves.domain;
22 import static org.junit.Assert.*;
24 import java.util.HashMap;
27 import org.junit.Test;
28 import org.springframework.beans.factory.annotation.Autowired;
30 public class CpuUsageArrayTest {
33 CpuUsageArray cpuUsageArray = new CpuUsageArray();
35 Map<String, Object> additionalProperties = new HashMap<String, Object>();
39 cpuUsageArray.setAdditionalProperty("name", value);
40 cpuUsageArray.setCpuIdentifier("test");
41 cpuUsageArray.setCpuIdle(2.2);
42 cpuUsageArray.setCpuUsageInterrupt(2.2);
43 cpuUsageArray.setCpuUsageNice(2.2);
44 cpuUsageArray.setCpuUsageSoftIrq(2.2);
45 cpuUsageArray.setCpuUsageSteal(2.2);
46 cpuUsageArray.setCpuUsageSystem(2.2);
47 cpuUsageArray.setCpuUsageUser(2.2);
48 cpuUsageArray.setCpuWait(2.2);
49 cpuUsageArray.setPercentUsage(2.2);
50 additionalProperties.put("name", value);
52 assertEquals(additionalProperties, cpuUsageArray.getAdditionalProperties());
53 assertEquals(new Double(2.2), cpuUsageArray.getCpuIdle());
54 assertEquals("test", cpuUsageArray.getCpuIdentifier());
55 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageInterrupt());
56 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageNice());
57 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSoftIrq());
58 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSteal());
59 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageSystem());
60 assertEquals(new Double(2.2), cpuUsageArray.getCpuUsageUser());
61 assertEquals(new Double(2.2), cpuUsageArray.getCpuWait());
62 assertEquals(new Double(2.2), cpuUsageArray.getPercentUsage());
63 assert (cpuUsageArray.toString() != null);
64 assert (cpuUsageArray.hashCode() != 0);
65 assertEquals(true, cpuUsageArray.equals(cpuUsageArray));