f688bb6832af94c9cbd2fd9f1a5cb2eae488294b
[dcaegen2/services.git] /
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  slice-analysis-ms
4  *  ================================================================================
5  *  Copyright (C) 2022 CTC, Inc.
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
10  *
11  *          http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  *
20  *******************************************************************************/
21
22 package org.onap.slice.analysis.ms.models;
23
24 import org.apache.commons.lang3.StringUtils;
25 import org.junit.Test;
26 import org.junit.runner.RunWith;
27 import org.powermock.core.classloader.annotations.PowerMockIgnore;
28 import org.powermock.modules.junit4.PowerMockRunner;
29 import org.powermock.modules.junit4.PowerMockRunnerDelegate;
30 import org.springframework.boot.test.context.SpringBootTest;
31 import org.springframework.test.context.junit4.SpringRunner;
32
33 import java.util.ArrayList;
34 import java.util.List;
35
36 import static org.junit.jupiter.api.Assertions.assertEquals;
37 import static org.junit.jupiter.api.Assertions.assertTrue;
38
39 @RunWith(PowerMockRunner.class)
40 @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
41 @PowerMockRunnerDelegate(SpringRunner.class)
42 @SpringBootTest(classes = SliceConfigRequestTest.class)
43 public class SliceConfigRequestTest {
44
45     @Test
46     public void SliceConfigRequestTest() {
47
48         List<String> sliceIdentifiers = new ArrayList<>();
49         List<String> configParams = new ArrayList<>();
50
51         SliceConfigRequest sliceConfigRequest = new SliceConfigRequest();
52         sliceConfigRequest.setConfigParams(configParams);
53         sliceConfigRequest.setSliceIdentifiers(sliceIdentifiers);
54
55
56         assertEquals(sliceIdentifiers, sliceConfigRequest.getSliceIdentifiers());
57         assertEquals(configParams, sliceConfigRequest.getConfigParams());
58     }
59
60     @Test
61     public void SliceConfigRequestEqualsTest() {
62
63         List<String> sliceIdentifiers = new ArrayList<>();
64         List<String> configParams = new ArrayList<>();
65
66         SliceConfigRequest sliceConfigRequest = new SliceConfigRequest();
67         sliceConfigRequest.setConfigParams(configParams);
68         sliceConfigRequest.setSliceIdentifiers(sliceIdentifiers);
69
70         SliceConfigRequest sliceConfigRequest1 = new SliceConfigRequest();
71         sliceConfigRequest1.setConfigParams(configParams);
72         sliceConfigRequest1.setSliceIdentifiers(sliceIdentifiers);
73
74
75         assertTrue(sliceConfigRequest1.equals(sliceConfigRequest));
76         assertTrue(StringUtils.isNotBlank(sliceConfigRequest.toString()));
77         assertTrue(sliceConfigRequest.hashCode() != 0);
78     }
79 }