Added oparent to sdc main
[sdc.git] / openecomp-be / lib / openecomp-sdc-versioning-lib / openecomp-sdc-versioning-api / src / test / java / org / openecomp / sdc / versioning / types / ItemTest.java
1 /*
2  *
3  *  Copyright © 2017-2018 European Support Limited
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  * Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  */
18
19 package org.openecomp.sdc.versioning.types;
20
21
22 import org.junit.Assert;
23 import org.junit.Test;
24 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
25
26 import java.util.EnumMap;
27 import java.util.HashMap;
28 import java.util.Map;
29
30 public class ItemTest {
31
32     @Test
33     public void testAddVersionStatus() {
34         Item item = new Item();
35         item.addVersionStatus(VersionStatus.Draft);
36         Assert.assertEquals(1, item.getVersionStatusCounters().size());
37     }
38
39     @Test
40     public void testAddProperty() {
41         Item item = new Item();
42         item.setProperties(new HashMap<>());
43         item.addProperty("item1", new Object());
44         Assert.assertEquals(1, item.getProperties().size());
45     }
46     @Test
47     public void testRemoveVersionStatus() {
48         Item item = new Item();
49         Map<VersionStatus, Integer> versionStatusCounters = new EnumMap<>(VersionStatus.class);
50         versionStatusCounters.put(VersionStatus.Draft, 1);
51         item.setVersionStatusCounters(versionStatusCounters);
52         item.removeVersionStatus(VersionStatus.Draft);
53         Assert.assertEquals(0, item.getVersionStatusCounters().size());
54     }
55
56 }