1 package org.openecomp.sdc.versioning.errors;
4 import org.junit.Assert;
6 import org.openecomp.sdc.common.errors.ErrorCategory;
7 import org.openecomp.sdc.common.errors.ErrorCode;
8 import org.openecomp.sdc.versioning.dao.types.Version;
10 import java.util.Arrays;
12 public class VersionableSubEntityNotFoundErrorBuilderTest {
15 VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType",
16 "entityId", "containingEntityType", "ContainingEntityId", new Version("0.0"));
17 ErrorCode build = builder.build();
18 Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id());
19 Assert.assertEquals(ErrorCategory.APPLICATION, build.category());
20 Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITY_NOT_FOUND_MSG,
21 "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message());
25 public void testWithListOfIds() {
26 VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType",
27 Arrays.asList("entityId"), "containingEntityType", "ContainingEntityId", new Version("0.0"));
28 ErrorCode build = builder.build();
29 Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id());
30 Assert.assertEquals(ErrorCategory.APPLICATION, build.category() );
31 Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITIES_NOT_FOUND_MSG,
32 "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message());