summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java
new file mode 100644
index 0000000000..d269204fba
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java
@@ -0,0 +1,34 @@
+package org.openecomp.sdc.versioning.errors;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Arrays;
+
+public class VersionableSubEntityNotFoundErrorBuilderTest {
+ @Test
+ public void test() {
+ VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType",
+ "entityId", "containingEntityType", "ContainingEntityId", new Version("0.0"));
+ ErrorCode build = builder.build();
+ Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id());
+ Assert.assertEquals(ErrorCategory.APPLICATION, build.category());
+ Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITY_NOT_FOUND_MSG,
+ "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message());
+ }
+
+ @Test
+ public void testWithListOfIds() {
+ VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType",
+ Arrays.asList("entityId"), "containingEntityType", "ContainingEntityId", new Version("0.0"));
+ ErrorCode build = builder.build();
+ Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id());
+ Assert.assertEquals(ErrorCategory.APPLICATION, build.category() );
+ Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITIES_NOT_FOUND_MSG,
+ "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message());
+ }
+} \ No newline at end of file