summaryrefslogtreecommitdiffstats
path: root/so-sdn-clients/src
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2021-07-21 17:40:43 +0200
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2021-07-21 17:40:43 +0200
commit34b0436df1ad8a11e29c588842ac491a6a6d7b26 (patch)
tree3ab9c6f98000b8c5af2ecfdc63d27571a870c61a /so-sdn-clients/src
parent1be8408f26d3f20cf2ffb923a956b7ba6dfbd994 (diff)
add junit coverage
Issue-ID: SO-3715 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com> Change-Id: I6da3048f6af8e0db671929b72ae0d5e468dd134b
Diffstat (limited to 'so-sdn-clients/src')
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java (renamed from so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java)33
1 files changed, 31 insertions, 2 deletions
diff --git a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
index a8816e1b04..fa3bf1d16c 100644
--- a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2021 - Nokia
+ * ================================================================================
* 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
@@ -18,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdn.common;
+package org.onap.so.client.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.util.LinkedHashMap;
@@ -29,7 +32,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SdnCommonTasks;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -101,4 +103,31 @@ public class SdnCommonTasksTest {
sdnCommonTasks.validateSDNResponse(responseMap);
}
+ @Test
+ public void validateSDNResponse_emptyWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ String result = sdnCommonTasks.validateSDNResponse(output);
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void validateSDNGetResponse_success() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", "value1");
+ String result = sdnCommonTasks.validateSDNGetResponse(output);
+ assertThat(result).isEqualTo("{\"key1\":\"value1\"}");
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ sdnCommonTasks.validateSDNGetResponse(output);
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenMapEmpty() throws Exception {
+ sdnCommonTasks.validateSDNGetResponse(new LinkedHashMap<>());
+ }
}