aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src/test/java/org/openecomp
diff options
context:
space:
mode:
authorm.kowalski3 <m.kowalski3@partner.samsung.com>2019-05-27 11:25:34 +0200
committerOren Kleks <orenkle@amdocs.com>2019-05-27 13:37:59 +0000
commit63abd2e775542aa7439ca8bc24a959794c249d00 (patch)
treead2ecb69f1b95ebe3d6cbdf13202dbd85eba1cf6 /common-app-api/src/test/java/org/openecomp
parentada9f9d10b5e6640bef6d020e89582256f2a1fa5 (diff)
Add unit test for ErrorConfiguration
Issue-ID: SDC-2327 Signed-off-by: Marcin Kowalski <m.kowalski3@partner.samsung.com> Change-Id: I7e324be0b75238bb782004ac1659d51e2c1f3ffc
Diffstat (limited to 'common-app-api/src/test/java/org/openecomp')
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java119
1 files changed, 79 insertions, 40 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java
index d9e6066224..6a45d1a8b7 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ErrorConfigurationTest.java
@@ -1,49 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.sdc.be.config;
+import static org.junit.Assert.assertEquals;
+import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
public class ErrorConfigurationTest {
- private ErrorConfiguration createTestSubject() {
- return new ErrorConfiguration();
- }
-
-
- @Test
- public void testGetErrors() throws Exception {
- ErrorConfiguration testSubject;
- Map<String, ErrorInfo> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getErrors();
- }
-
-
- @Test
- public void testSetErrors() throws Exception {
- ErrorConfiguration testSubject;
- Map<String, ErrorInfo> errors = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setErrors(errors);
- }
-
-
-
-
-
- @Test
- public void testToString() throws Exception {
- ErrorConfiguration testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
+ private ErrorConfiguration createTestSubject() {
+ return new ErrorConfiguration();
+ }
+
+ @Test
+ public void testGetErrors() throws Exception {
+ ErrorConfiguration testSubject;
+ Map<String, ErrorInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getErrors();
+ }
+
+
+ @Test
+ public void testSetErrors() throws Exception {
+ ErrorConfiguration testSubject;
+ Map<String, ErrorInfo> errors = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setErrors(errors);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ ErrorConfiguration testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+
+ @Test
+ public void testGetErrorInfo() {
+ //given
+ Map<String, ErrorInfo> errors = new HashMap<>();
+ ErrorInfo errorInfo = new ErrorInfo();
+ errorInfo.setCode(100);
+ errorInfo.setMessageId("1");
+ errorInfo.setMessage("Mock message");
+ errors.put("key", errorInfo);
+ ErrorConfiguration testSubject;
+ testSubject = createTestSubject();
+ testSubject.setErrors(errors);
+ //when
+ ErrorInfo clonedErrorInfo = testSubject.getErrorInfo("key");
+ //then
+ assertEquals(errorInfo.getErrorInfoType(), clonedErrorInfo.getErrorInfoType());
+ assertEquals(errorInfo.getCode(), clonedErrorInfo.getCode());
+ assertEquals(errorInfo.getMessageId(), clonedErrorInfo.getMessageId());
+ assertEquals(errorInfo.getMessage(), clonedErrorInfo.getMessage());
+ }
} \ No newline at end of file