summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src
diff options
context:
space:
mode:
authorTomasz Golabek <tomasz.golabek@nokia.com>2019-08-07 15:35:28 +0200
committerTomasz Golabek <tomasz.golabek@nokia.com>2019-08-08 06:25:27 +0000
commit430315ac3ff6d557a128b8611a2e7a30ca757a86 (patch)
tree9f29f8ff9db5465ddbb034d051b6895fe95e41b9 /openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src
parentfd6ba7eed34a05e46a90c61288702484576df03a (diff)
Additional unit tests
Tests for conflict-api mostly bean matchers for getters and setters Change-Id: I924b17986dfbc419da391fae0d33bb458d97f465 Issue-ID: SDC-2326 Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src')
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java4
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java5
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictInfoTest.java34
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictResolutionTest.java34
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictTest.java34
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ItemVersionConflictTest.java44
6 files changed, 155 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java
index a7b1ff3bf4..80186f876b 100644
--- a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java
@@ -20,12 +20,16 @@
package org.openecomp.conflicts.types;
+import com.google.common.annotations.VisibleForTesting;
import org.openecomp.sdc.datatypes.model.ElementType;
public class Conflict<T> extends ConflictInfo {
private T yours;
private T theirs;
+ @VisibleForTesting
+ Conflict() {}
+
public Conflict(String id, ElementType type, String name) {
super(id, type, name);
}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java
index 3f6788538b..af4111c1dd 100644
--- a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java
@@ -20,6 +20,7 @@
package org.openecomp.conflicts.types;
+import com.google.common.annotations.VisibleForTesting;
import org.openecomp.sdc.datatypes.model.ElementType;
public class ConflictInfo {
@@ -27,6 +28,10 @@ public class ConflictInfo {
private ElementType type;
private String name;
+ @VisibleForTesting
+ ConflictInfo() {
+ }
+
public ConflictInfo(String id, ElementType type, String name) {
this.id = id;
this.type = type;
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictInfoTest.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictInfoTest.java
new file mode 100644
index 0000000000..bfd57d505f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictInfoTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.conflicts.types;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class ConflictInfoTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ConflictInfoTest.class, hasValidGettersAndSetters());
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictResolutionTest.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictResolutionTest.java
new file mode 100644
index 0000000000..3af52330da
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictResolutionTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.conflicts.types;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class ConflictResolutionTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ConflictResolution.class, hasValidGettersAndSetters());
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictTest.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictTest.java
new file mode 100644
index 0000000000..580458c00f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ConflictTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.conflicts.types;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ConflictTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Conflict.class, hasValidGettersAndSetters());
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ItemVersionConflictTest.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ItemVersionConflictTest.java
new file mode 100644
index 0000000000..10f9148d6f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/test/java/org/openecomp/conflicts/types/ItemVersionConflictTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.conflicts.types;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ItemVersionConflictTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ItemVersionConflict.class, hasValidGettersAndSetters());
+ }
+
+ @Test
+ public void shouldAddItemToList() {
+ ItemVersionConflict itemVersionConflict = new ItemVersionConflict();
+ ConflictInfo conflictInfo = new ConflictInfo();
+ itemVersionConflict.addElementConflictInfo(conflictInfo);
+ assertEquals(itemVersionConflict.getElementConflicts().size(),1 );
+ assertTrue(itemVersionConflict.getElementConflicts().contains(conflictInfo));
+ }
+} \ No newline at end of file