Adding unit tests
[sdc.git] / openecomp-be / lib / openecomp-sdc-vendor-software-product-lib / openecomp-sdc-vendor-software-product-api / src / test / java / org / openecomp / sdc / vendorsoftwareproduct / types / candidateheat / AnalyzedZipHeatFilesTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
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 package org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat;
21
22 import static org.junit.jupiter.api.Assertions.assertEquals;
23 import org.junit.jupiter.api.Test;
24
25 import java.util.Arrays;
26 import java.util.HashSet;
27 import java.util.List;
28
29 public class AnalyzedZipHeatFilesTest {
30
31     private AnalyzedZipHeatFiles testSubject = new AnalyzedZipHeatFiles();
32
33     @Test
34     public void testGetFilesNotEligbleForModules() {
35         testSubject.addNestedFile("testfile1");
36         testSubject.addModuleFile("testfile2");
37         HashSet<String> fileNames = new HashSet<>();
38         fileNames.addAll(Arrays.asList("testfile2", "testfile3"));
39         testSubject.addNestedFiles(fileNames);
40
41         testSubject.addOtherNonModuleFile("testfile4");
42         testSubject.addModuleFile("testfile5");
43         testSubject.addModuleFile("testfile7");
44         HashSet<String> fileNames2 = new HashSet<>();
45         fileNames2.addAll(Arrays.asList("testfile5", "testfile6"));
46         testSubject.addOtherNonModuleFiles(fileNames2);
47
48         HashSet<String> moduelFiles = (HashSet<String>) testSubject.getModuleFiles();
49         assertEquals(1, moduelFiles.size());
50         assertEquals("testfile7", moduelFiles.iterator().next());
51
52         List<String> res = (List<String>) testSubject.getFilesNotEligbleForModules();
53         assertEquals(6, res.size());
54     }
55 }