d269204fba134405caff4e28151c0f0eef943a3b
[sdc.git] /
1 package org.openecomp.sdc.versioning.errors;
2
3
4 import org.junit.Assert;
5 import org.junit.Test;
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;
9
10 import java.util.Arrays;
11
12 public class VersionableSubEntityNotFoundErrorBuilderTest {
13     @Test
14     public void test() {
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());
22     }
23
24     @Test
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());
33     }
34 }