diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java')
15 files changed, 323 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/CheckinOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..bc91614c21 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,22 @@ +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; + +public class CheckinOnEntityLockedByOtherErrorBuilderTest { + + @Test + public void test() { + CheckinOnEntityLockedByOtherErrorBuilder builder = new CheckinOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + ErrorCode build = builder.build(); + + Assert.assertEquals(VersioningErrorCodes.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(CheckinOnEntityLockedByOtherErrorBuilder.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, "entityType", "entityId", "lockingUser") , build.message()); + } + +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..e72eefe784 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +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; + +public class CheckinOnUnlockedEntityErrorBuilderTest { + + @Test + public void test() { + CheckinOnUnlockedEntityErrorBuilder builder = new CheckinOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.CHECKIN_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(CheckinOnUnlockedEntityErrorBuilder.CHECKIN_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..2a8cabbca8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +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; + +public class CheckoutOnLockedEntityErrorBuilderTest { + @Test + public void test() { + CheckoutOnLockedEntityErrorBuilder builder = new CheckoutOnLockedEntityErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.CHECKOT_ON_LOCKED_ENTITY, build.id() ); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category() ); + Assert.assertEquals(String.format(CheckoutOnLockedEntityErrorBuilder.CHECKOT_ON_LOCKED_ENTITY_MSG, + "entityType", "entityId", "lockingUser") , build.message()); + } + +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..523b2261d0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +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; + + +public class DeleteOnLockedEntityErrorBuilderTest { + + @Test + public void test() { + DeleteOnLockedEntityErrorBuilder builder = new DeleteOnLockedEntityErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.DELETE_ON_LOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(DeleteOnLockedEntityErrorBuilder.DELETE_ON_LOCKED_ENTITY_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..b37a0e4423 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,21 @@ +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; + + +public class EditOnEntityLockedByOtherErrorBuilderTest { + @Test + public void test() { + EditOnEntityLockedByOtherErrorBuilder builder = new EditOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EditOnEntityLockedByOtherErrorBuilder.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, + "entityType", "entityId", "lockingUser"),build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..b2287611fc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,21 @@ +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; + +public class EditOnUnlockedEntityErrorBuilderTest { + @Test + public void test() { + EditOnUnlockedEntityErrorBuilder builder = new EditOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EditOnUnlockedEntityErrorBuilder.EDIT_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java new file mode 100644 index 0000000000..17c01278bd --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java @@ -0,0 +1,20 @@ +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; + +public class EntityAlreadyExistErrorBuilderTest { + @Test + public void test() { + EntityAlreadyExistErrorBuilder builder = new EntityAlreadyExistErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_ENTITY_ALREADY_EXIST, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityAlreadyExistErrorBuilder.VERSIONABLE_ENTITY_ALREADY_EXIST_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java new file mode 100644 index 0000000000..860219f85d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java @@ -0,0 +1,20 @@ +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; + +public class EntityAlreadyFinalizedErrorBuilderTest { + @Test + public void test() { + + EntityAlreadyFinalizedErrorBuilder builder = new EntityAlreadyFinalizedErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityAlreadyFinalizedErrorBuilder.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java new file mode 100644 index 0000000000..9cf5cab361 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java @@ -0,0 +1,20 @@ +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; + +public class EntityNotExistErrorBuilderTest { + @Test + public void test() { + EntityNotExistErrorBuilder builder = new EntityNotExistErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityNotExistErrorBuilder.VERSIONABLE_ENTITY_NOT_EXIST_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java new file mode 100644 index 0000000000..5aa9ff8cd3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java @@ -0,0 +1,18 @@ +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; + +public class RequestedVersionInvalidErrorBuilderTest { + @Test + public void test() { + RequestedVersionInvalidErrorBuilder builder = new RequestedVersionInvalidErrorBuilder(); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.REQUESTED_VERSION_INVALID, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(RequestedVersionInvalidErrorBuilder.REQUESTED_VERSION_INVALID_MSG, build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java new file mode 100644 index 0000000000..e648663ceb --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java @@ -0,0 +1,18 @@ +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; + +public class RevisionIdNotFoundErrorBuilderTest { + @Test + public void test() { + RevisionIdNotFoundErrorBuilder builder = new RevisionIdNotFoundErrorBuilder(); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.MANDATORY_FIELD_REVISION_ID_MISSING, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(RevisionIdNotFoundErrorBuilder.REVISION_ID_NOT_FOUND_MSG, build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java new file mode 100644 index 0000000000..0695cab76a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java @@ -0,0 +1,21 @@ +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; + +public class SubmitLockedEntityNotAllowedErrorBuilderTest { + @Test + public void test() { + SubmitLockedEntityNotAllowedErrorBuilder builder = new SubmitLockedEntityNotAllowedErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(SubmitLockedEntityNotAllowedErrorBuilder.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..e19fec0777 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,22 @@ +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; + +public class UndoCheckoutOnEntityLockedByOtherErrorBuilderTest { + @Test + public void test() { + + UndoCheckoutOnEntityLockedByOtherErrorBuilder builder = new UndoCheckoutOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(UndoCheckoutOnEntityLockedByOtherErrorBuilder.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..52599ecca4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,20 @@ +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; + +public class UndoCheckoutOnUnlockedEntityErrorBuilderTest { + @Test + public void test() { + UndoCheckoutOnUnlockedEntityErrorBuilder builder = new UndoCheckoutOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(UndoCheckoutOnUnlockedEntityErrorBuilder.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file 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 |