3 * Copyright © 2017-2018 European Support Limited
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 package org.openecomp.sdc.versioning.types;
22 import org.junit.Assert;
23 import org.junit.Test;
24 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
26 import java.util.EnumMap;
27 import java.util.HashMap;
30 public class ItemTest {
33 public void testAddVersionStatus() {
34 Item item = new Item();
35 item.addVersionStatus(VersionStatus.Draft);
36 Assert.assertEquals(1, item.getVersionStatusCounters().size());
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());
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());